Paths and environment variables in artifact paths #25576
-
Hello, I am having some issue finding the path to where a checkout happens. I could of course, set an environment variable to the If I save a file in a step, how can I get that path to the artifact path so that it is saved? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is a default environment variable named GITHUB_WORKSPACE. The GitHub workspace directory path. The workspace directory contains a subdirectory with a copy of your repository if your workflow uses the actions/checkout action. If you don’t use the actions/checkout action, the directory will be empty. For example, /home/runner/work/my-repo-name/my-repo-name. If you don’t set working-directory keyword in your step, the default working directory is /home/runner/work/my-repo-name/my-repo-name. Let me show you an example, there is my file structure in the repo: After checkout action, these folders and files in the root of my repo will exist under /home/runner/work/orgrepo1/orgrepo1 I want to upload contents under projects/frontend folder. Then I use path: ./projects/frontend/ in actions/upload-artifact@v1.0.0. name: publish artifacts on: push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Upload artifact uses: actions/upload-artifact@v1.0.0 with: # Artifact name name: drop1 # Directory containing files to upload path: ./projects/frontend/ |
Beta Was this translation helpful? Give feedback.
There is a default environment variable named GITHUB_WORKSPACE.
The GitHub workspace directory path. The workspace directory contains a subdirectory with a copy of your repository if your workflow uses the actions/checkout action. If you don’t use the actions/checkout action, the directory will be empty. For example, /home/runner/work/my-repo-name/my-repo-name.
If you don’t set working-directory keyword in your step, the default working directory is /home/runner/work/my-repo-name/my-repo-name.
Let me show you an example, there is my file structure in the repo:
After checkout action, these folders and files in the root of my repo will exist under /home/runne…