Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the meaning of "current working directory" in the readme #87

Open
2 of 5 tasks
orthoxerox opened this issue Jun 19, 2020 · 3 comments · May be fixed by #477
Open
2 of 5 tasks

Clarify the meaning of "current working directory" in the readme #87

orthoxerox opened this issue Jun 19, 2020 · 3 comments · May be fixed by #477
Labels
documentation Improvements or additions to documentation

Comments

@orthoxerox
Copy link

orthoxerox commented Jun 19, 2020

Describe the bug
The readme says "Relative and absolute file paths are both allowed. Relative paths are rooted against the current working directory", but this doesn't mean the current working directory as reported by pwd, but the working directory of the job.

Version

  • [?] V1
  • V2

Environment

  • self-hosted
  • Linux
  • Windows
  • Mac

Run/Repo Url
This run finishes with a warning because the file cannot be found, even though the previous step changed the working directory to the directory containing the artifact

This run(absolute) and this run (relative) finish correctly, because the relative path is relative to the starting directory of the job

How to reproduce
Add a run step before this step that changes the working directory via cd

@orthoxerox orthoxerox added the bug Something isn't working label Jun 19, 2020
@konradpabjan konradpabjan added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jul 28, 2020
@peterbraden
Copy link

It doesn't appear that it respects the default working directory?

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults

@ronlut
Copy link

ronlut commented Oct 3, 2020

It doesn't appear that it respects the default working directory?

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults

Misleading indeed, had that problem myself.
Then noticed the workflow syntax documentation states it sets the working directory for run steps only, so maybe that's why it doesn't work as you would expect.

@andy-brainome
Copy link

Ran across the default working-directory issue myself.
I expected it to just work but then again...

defaults:
  run:
    shell: bash
    working-directory: client

jobs:

  create_save_file:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2

    - name: save file to disk
      run: |
        echo 'xyzzy' > save_file.txt

    - name: report file info
      run: |
        pwd
        ls -la save_file.txt
        echo "save_file.txt = `cat save_file.txt`"

    - name: save file for next job
      uses: actions/upload-artifact@v2
      with:
        name: save_file_txt
        path: client/save_file.txt
        if-no-files-found: error

    - name: save file for next job
      uses: actions/upload-artifact@v2
      with:
        name: save_file_txt
        path: save_file.txt
        if-no-files-found: error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
5 participants