From 5f375cca4b67e6d6865358725f7b3016adc11dd4 Mon Sep 17 00:00:00 2001 From: Konrad Pabjan Date: Mon, 6 Dec 2021 16:35:35 -0500 Subject: [PATCH] Document how to correctly use environment variables for path input (#274) * Update README.md * Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 95b8526..10e084d 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,20 @@ Environment variables along with context expressions can also be used for input. path: ${{ github.workspace }}/artifact/**/* ``` +For environment variables created in other steps, make sure to use the `env` expression syntax + +``` + steps: + - run: | + mkdir testing + echo "This is a file to upload" > testing/file.txt + echo "artifactPath=testing/file.txt" >> $GITHUB_ENV + - uses: actions/upload-artifact@v2 + with: + name: artifact + path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime +``` + ### Retention Period Artifacts are retained for 90 days by default. You can specify a shorter retention period using the `retention-days` input: