nektos / act

Run your GitHub Actions locally 🚀
https://nektosact.com
MIT License
55.08k stars 1.38k forks source link

working-directory not getting applied when using node #1981

Open raghavharness opened 1 year ago

raghavharness commented 1 year ago

Bug report info

act version:            0.2.49
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 10
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/raghav/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.6
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.49
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        20.10.13
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               aarch64
        OS kernel:             5.10.104-linuxkit
        OS CPU:                5
        OS memory:             7851 MB
        Security options:
                name=seccomp,profile=default
                name=cgroupns

Command used with act

act -W workflow.yml -P -self-hosted=-self-hosted -b --detect-event

Describe issue

When a step in action.yml runs using node then even after providing a working directory to the step it always runs in nektos default directory. I also tried in a normal run script step and there setting working directory works fine.

Link to GitHub repository

https://github.com/raghavharness/hello-world-javascript-action

Workflow content

name: github-action
"on": custom
jobs:
  action:
    name: action
    runs-on: -self-hosted
    steps:
    - name: Check working directory
      id: step_one
      working-directory: /Users/raghav
      run: |
        echo $PWD // prints /Users/raghav
    - name: Check working directory 2
      id: step_two
      working-directory: /Users/raghav
      uses: raghavharness/hello-world-javascript-action@main // prints nektos default WD

Relevant log output

[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'
[github-action/action]   ☁  git clone 'https://github.com/raghavharness/hello-world-javascript-action' # ref=main
5
[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'
[github-action/action] ⭐ Run Main Check working directory
4
[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'
[github-action/action]   | /Users/raghav
[github-action/action]   ✅  Success - Main Check working directory
5
[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'
[github-action/action] ⭐ Run Main Check working directory 2
3
[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'
[github-action/action]   | PWD /Users/raghav/.cache/act/90abacb54893bf6f/hostexecutor
[github-action/action]   ✅  Success - Main Check working directory 2
[github-action/action] 🏁  Job succeeded
Starting: /Users/raghav/go/bin/dlv dap --listen=127.0.0.1:51566 --log-dest=3 from /Users/raghav/harness/adhoc/act
DAP server listening at: 127.0.0.1:51566
Type 'dlv help' for list of commands.
[github-action/action] unable to get git ref: failed to identify reference (tag/branch) for the checked-out revision 'd5d854854651c151ecd914bb6e2e370e0057929a'

Additional information

No response

ChristopherHX commented 1 year ago

Sorry but this open source project is not for requesting features for the GitHub Actions platform.

I want to remind you, what you are doing here is a syntax error in GitHub Actions.