[GH-ISSUE #441] working-directory syntax use environment value is not working #307

Closed
opened 2026-03-01 21:42:14 +03:00 by kerem · 6 comments
Owner

Originally created by @dkswjdals89 on GitHub (Dec 9, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/441

Hello!
First of all, thank you very much for making this great tool. 😄

I tried to perform github action in the local environment using the tool, but there was a problem.
I want to add the working-directory value to the env and inject it into the required step.
Example

jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
      WORKING_DIRECTORY: ./services/test

   steps:
      - name: test
         working-directory: ${{env.WORKING_DIRECTORY}}
         run: ls -R

The github action actually works very well, but an error occurs in the act tool.

Error Message:

/github/workflow/5: line 1: ${{env.WORKING_DIRECTORY}}: bad substitution

Is there any other way to use this problem or can it be improved?

Thank you.

Originally created by @dkswjdals89 on GitHub (Dec 9, 2020). Original GitHub issue: https://github.com/nektos/act/issues/441 Hello! First of all, thank you very much for making this great tool. 😄 I tried to perform github action in the local environment using the tool, but there was a problem. I want to add the working-directory value to the env and inject it into the required step. Example ```yml jobs: deploy: runs-on: ubuntu-latest env: WORKING_DIRECTORY: ./services/test steps: - name: test working-directory: ${{env.WORKING_DIRECTORY}} run: ls -R ``` The github action actually works very well, but an error occurs in the act tool. Error Message: ``` /github/workflow/5: line 1: ${{env.WORKING_DIRECTORY}}: bad substitution ``` Is there any other way to use this problem or can it be improved? Thank you.
kerem 2026-03-01 21:42:14 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@aldegoeij commented on GitHub (Dec 21, 2020):

Ha, took me a while to find this issue, having exactly the same problem. Using working-directory to do prd/acc/dev etc.

<!-- gh-comment-id:748925425 --> @aldegoeij commented on GitHub (Dec 21, 2020): Ha, took me a while to find this issue, having exactly the same problem. Using working-directory to do prd/acc/dev etc.
Author
Owner

@aldegoeij commented on GitHub (Dec 21, 2020):

so actually this is the same issue as https://github.com/nektos/act/issues/181, https://github.com/nektos/act/issues/337, https://github.com/nektos/act/issues/315, https://github.com/nektos/act/issues/435 😄

If I change the workflow yml from:

    defaults:
      run:
        working-directory: infrastructure/${{ matrix.environment }}

to:

    defaults:
      run:
        working_directory: infrastructure/${{ matrix.environment }}

(so working-directory to working_directory) the error goes away 💪

Of course that breaks the workflow from running, but at least it, we now know the interpolation / hyphen errors occurs with the YAML processing, apparently when there is a variable used.

<!-- gh-comment-id:748927645 --> @aldegoeij commented on GitHub (Dec 21, 2020): so actually this is the same issue as https://github.com/nektos/act/issues/181, https://github.com/nektos/act/issues/337, https://github.com/nektos/act/issues/315, https://github.com/nektos/act/issues/435 😄 If I change the workflow yml from: ```yaml defaults: run: working-directory: infrastructure/${{ matrix.environment }} ``` to: ```yaml defaults: run: working_directory: infrastructure/${{ matrix.environment }} ``` (so `working-directory` to `working_directory`) the error goes away 💪 Of course that breaks the workflow from running, but at least it, we now know the interpolation / hyphen errors occurs with the YAML processing, apparently when there is a variable used.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2021):

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

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

@EronWright commented on GitHub (Jan 29, 2021):

@dkswjdals89 why did you close the issue? Doesn't seem fixed by the mentioned issues.

<!-- gh-comment-id:770062184 --> @EronWright commented on GitHub (Jan 29, 2021): @dkswjdals89 why did you close the issue? Doesn't seem fixed by the mentioned issues.
Author
Owner

@xaviergmail commented on GitHub (Apr 7, 2021):

I can confirm that this issue persists and that build matrices are also affected:

test:
    strategy:
      matrix:
        package:
          - test-package-name
      - run: ls -ltr
        working-directory: ${{ matrix.package }}

Just going on a limb and assuming that something like #511 should fix this

<!-- gh-comment-id:815107294 --> @xaviergmail commented on GitHub (Apr 7, 2021): I can confirm that this issue persists and that build matrices are also affected: ```yaml test: strategy: matrix: package: - test-package-name - run: ls -ltr working-directory: ${{ matrix.package }} ``` Just going on a limb and assuming that something like #511 should fix this
Author
Owner

@hs-amartin commented on GitHub (Jun 1, 2021):

This is still broken in the latest release.

<!-- gh-comment-id:852437729 --> @hs-amartin commented on GitHub (Jun 1, 2021): This is still broken in the latest release.
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#307
No description provided.