first of all thank you for this action ! it is very usefull !
secondly I have a feature request,
actions/upload-artifact
- uses: actions/upload-artifact@v1
with:
name: all_reports
path: all_reports
I would like to be able to change the name based on the GITHUB_REF env variables
I tried this but it wont work:
- uses: actions/upload-artifact@v1
with:
name: all_reports_${GITHUB_REF}
path: all_reports
I also have tried
name: all_reports_${{ GITHUB_REF }}
no luck
Hi, just being helpful:
Instead of name: all_reports_${{ GITHUB_REF }} try name: all_reports_${{ env.GITHUB_REF }}
The default "context" of template expressions is a collection of root contexts, so to use environment variables you need to use env context: https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions#env-context
I get
Here is my workflow:
- name: Upload artifact
uses: actions/[email protected]
with:
# Artifact name
name: docker_${{ env.$GITHUB_RUN_NUMBER }}
# Directory containing files to upload
path: .
Is there a workaround for this?
@Allendorf243 I think you've got an extra $ in there. You probably want ${{ env.GITHUB_RUN_NUMBER }}
@medyagh @ipmb I couldn't make it work neither with ${{ env.GITHUB_RUN_NUMBER }}.
However it worked with ${{ github.run_number }} 馃憣馃徑
You can use env variables as input, in your example though you should be using the github context to get the REF.
https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
Example
jobs:
example:
runs-on: [ubuntu-latest]
env:
input: environment_variable
steps:
# use variable from env context
- uses: actions/upload-artifact@v1
with:
name: all_reports_${env.input}
path: all_reports
# use variable from github context
- uses: actions/upload-artifact@v1
with:
name: all_reports_${github.ref}
path: all_reports
Most helpful comment
@medyagh @ipmb I couldn't make it work neither with
${{ env.GITHUB_RUN_NUMBER }}.However it worked with
${{ github.run_number }}馃憣馃徑