act: Issue: Can't `use` action from repo checked out with actions/checkout
Act version
❯ act --version
act version 0.2.20
Expected behaviour
Expected to be able to locally test a github action workflow that checks out a repo containing another action, and then executes that action in the runner env with uses
Actual behaviour
act
fails with error message Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory
While the repo is sucessfully checked out to the runner env, it appears that act
does not look within the runner env when evaluating local uses
.
Workflow and/or repository
foo/example
is not a real repository.
workflow
on:
workflow_dispatch:
push:
branches:
- master
jobs:
track:
runs-on: ubuntu-latest
steps:
- name: Example
uses: actions/checkout@v2
with:
repository: foo/example
ref: 'master'
token: ${{ secrets.TOKEN }}
path: example
- uses: ./example
Steps to reproduce
act
output
I’ve scrubbed sensitive information from the log below.
Log
❯ act workflow_dispatch -j track
[track_updates.yml/track] 🚀 Start image=catthehacker/ubuntu:act-latest
[track_updates.yml/track] 🐳 docker run image=catthehacker/ubuntu:act-latest entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[track_updates.yml/track] ⭐ Run actions/checkout@v2
[track_updates.yml/track] ☁ git clone 'https://github.com/actions/checkout' # ref=v2
[track_updates.yml/track] 🐳 docker cp src=/home/*****/.cache/act/actions-checkout@v2 dst=/actions/
[track_updates.yml/track] ❓ ::save-state name=isPost,::true
[track_updates.yml/track] 💬 ::debug::GITHUB_WORKSPACE = '/github/workspace'
[track_updates.yml/track] 💬 ::debug::qualified repository = '*****/example'
[track_updates.yml/track] 💬 ::debug::ref = 'master'
[track_updates.yml/track] 💬 ::debug::commit = 'undefined'
[track_updates.yml/track] 💬 ::debug::clean = true
[track_updates.yml/track] 💬 ::debug::fetch depth = 1
[track_updates.yml/track] 💬 ::debug::lfs = false
[track_updates.yml/track] 💬 ::debug::submodules = false
[track_updates.yml/track] 💬 ::debug::recursive submodules = false
[track_updates.yml/track] ❓ ::add-matcher::/actions/actions-checkout@v2/dist/problem-matcher.json
| Syncing repository: *****/example
[track_updates.yml/track] ❓ ::group::Getting Git version info
| Working directory is '/github/workspace/example'
[track_updates.yml/track] 💬 ::debug::Getting git version
| [command]/usr/bin/git version
| git version 2.17.1
[track_updates.yml/track] ❓ ::endgroup::
| The repository will be downloaded using the GitHub REST API
| To create a local Git repository instead, add Git 2.18 or higher to the PATH
| Downloading the archive
| Writing archive to disk
| Extracting the archive
| [command]/bin/tar xz -C /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d -f /github/workspace/example/55a2a4cd-1017-460a-aa87-2f9fe0403a6d.tar.gz
| Resolved version *****-example-bd7968a95c64507048d8f41ce61fbd33030a69ce
[track_updates.yml/track] ❓ ::remove-matcher owner=checkout-git,::
[track_updates.yml/track] ✅ Success - actions/checkout@v2
[track_updates.yml/track] ⭐ Run ./example
[track_updates.yml/track] ❌ Failure - ./example
Error: open /home/*****/gh-action-test-repo/example/action.yaml: no such file or directory
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
For reference, this has nothing to do with checkouts per se. And nothing to do with private repositories.
https://github.com/jsoref/nektos-act-issues-550/runs/2263398812?check_suite_focus=true
Fwiw, the reason I’m using curl instead of checkout here is that I don’t seem to have a token that makes github’s checkout action happy. But, it does conveniently show that the problem isn’t relating to checking out 😃.
The problem is that the code that looks for action.yml/action.yaml isn’t looking inside the container: https://github.com/nektos/act/blob/b9a7bc620228df56dcc0684f09391ea481c9fb04/pkg/runner/step_context.go#L309-L311
Generally fixing things in act isn’t particularly hard, so if someone wants to give it a try, they’re welcome to.
This isn’t a problem I’m hitting, so it isn’t high on my list (I’m not a member of act fwiw, I’m just trying to clean things up for some of my own workflows).