[GH-ISSUE #211] Does not honor working-directory #142

Closed
opened 2026-03-01 21:40:36 +03:00 by kerem · 10 comments
Owner

Originally created by @fejx on GitHub (Apr 28, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/211

Originally assigned to: @catthehacker on GitHub.

Thanks for the awesome tool! It saved me a lot of time ❤️
However, while using it, I stumbled upon an issue.
Act does not honor the working-directory key you can set for run steps. It should cd into the specified path.

Steps to reproduce

Workflow

on: push

jobs:
  build:
    name: Test working directory
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.1.0
      - run: pwd
        working-directory: client
      - run: pwd

GitHub output

Run pwd
/home/runner/work/test-project/test-project/client


Run pwd
/home/runner/work/test-project/test-project

Local output from Act

[working-dir-test.yml/Test working directory] ⭐  Run pwd
| /github/workspace
[working-dir-test.yml/Test working directory]   ✅  Success - pwd
[working-dir-test.yml/Test working directory] ⭐  Run pwd
| /github/workspace
[working-dir-test.yml/Test working directory]   ✅  Success - pwd
Originally created by @fejx on GitHub (Apr 28, 2020). Original GitHub issue: https://github.com/nektos/act/issues/211 Originally assigned to: @catthehacker on GitHub. Thanks for the awesome tool! It saved me a lot of time :heart: However, while using it, I stumbled upon an issue. Act does not honor the `working-directory` key you can set for `run` steps. It should `cd` into the specified path. ## Steps to reproduce ### Workflow ```yml on: push jobs: build: name: Test working directory runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.1.0 - run: pwd working-directory: client - run: pwd ``` ### GitHub output ``` Run pwd /home/runner/work/test-project/test-project/client Run pwd /home/runner/work/test-project/test-project ``` ### Local output from Act ``` [working-dir-test.yml/Test working directory] ⭐ Run pwd | /github/workspace [working-dir-test.yml/Test working directory] ✅ Success - pwd [working-dir-test.yml/Test working directory] ⭐ Run pwd | /github/workspace [working-dir-test.yml/Test working directory] ✅ Success - pwd ```
Author
Owner

@github-actions[bot] commented on GitHub (Jul 13, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:657298320 --> @github-actions[bot] commented on GitHub (Jul 13, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@audioboxer217 commented on GitHub (Jul 13, 2020):

Mostly leaving a comment to keep this from going stale. It's not stale, I am still seeing this issue and currently not utilizing act because of it. Which is disappointing because, as @fejx said, this really is an awesome tool!

<!-- gh-comment-id:657608380 --> @audioboxer217 commented on GitHub (Jul 13, 2020): Mostly leaving a comment to keep this from going stale. It's not stale, I am still seeing this issue and currently not utilizing act because of it. Which is disappointing because, as @fejx said, this really is an awesome tool!
Author
Owner

@plauche commented on GitHub (Jul 30, 2020):

I'm also running into this issue! We set the working directory as a top level default:

jobs:
  lint:
    runs-on: ubuntu-latest
    name: A job to run the tests and linter
    defaults:
      run:
        working-directory: backend/

But it does not appear to be honored.

<!-- gh-comment-id:666600013 --> @plauche commented on GitHub (Jul 30, 2020): I'm also running into this issue! We set the working directory as a top level default: ```yaml jobs: lint: runs-on: ubuntu-latest name: A job to run the tests and linter defaults: run: working-directory: backend/ ``` But it does not appear to be honored.
Author
Owner

@iongion commented on GitHub (Aug 14, 2020):

The same for defaults

name: Pipeline

on: [push]

defaults:
  run:
    working-directory: thumbnailer

jobs:
  build:

    runs-on: ubuntu-latest
...
<!-- gh-comment-id:673960922 --> @iongion commented on GitHub (Aug 14, 2020): The same for defaults ``` name: Pipeline on: [push] defaults: run: working-directory: thumbnailer jobs: build: runs-on: ubuntu-latest ... ```
Author
Owner

@pfeigl commented on GitHub (Aug 21, 2020):

Yep, running into the same problem :-( Also trying to set on defaults level as described in this help page
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun

<!-- gh-comment-id:678455139 --> @pfeigl commented on GitHub (Aug 21, 2020): Yep, running into the same problem :-( Also trying to set on `defaults` level as described in this help page https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun
Author
Owner

@github-actions[bot] commented on GitHub (Oct 21, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:713217223 --> @github-actions[bot] commented on GitHub (Oct 21, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@esammer commented on GitHub (May 5, 2021):

Can confirm this is still an issue. This is an issue for those of us with mono repos and workflows that build a particular slice when pushes contain a path. act version 0.2.21.

<!-- gh-comment-id:832976141 --> @esammer commented on GitHub (May 5, 2021): Can confirm this is still an issue. This is an issue for those of us with mono repos and workflows that build a particular slice when pushes contain a path. act version 0.2.21.
Author
Owner

@ebadusb commented on GitHub (May 17, 2021):

I am seeing this as well.

<!-- gh-comment-id:841905003 --> @ebadusb commented on GitHub (May 17, 2021): I am seeing this as well.
Author
Owner

@ThanhDat-Vo commented on GitHub (Aug 9, 2021):

I got this issue too, I declared

defaults:
  run:
    working-directory: ./work_space. 

and it simply does not work

<!-- gh-comment-id:894915648 --> @ThanhDat-Vo commented on GitHub (Aug 9, 2021): I got this issue too, I declared ``` defaults: run: working-directory: ./work_space. ``` and it simply does not work
Author
Owner

@btchoungombiandja commented on GitHub (Jul 17, 2024):

Also seeing the same error

<!-- gh-comment-id:2233510374 --> @btchoungombiandja commented on GitHub (Jul 17, 2024): Also seeing the same error
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#142
No description provided.