[GH-ISSUE #1112] Issue: act not checking out in composite actions #632

Closed
opened 2026-03-01 21:45:06 +03:00 by kerem · 4 comments
Owner

Originally created by @alex-harvey-z3q on GitHub (Apr 6, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1112

System information

  • Operating System: Mac OS X
  • Architecture: ARM
  • Docker version: 20.10.12
  • Docker image used in act: custom
  • act version: latest

Setup

Contents of project dir

▶ pwd
▶ ls -1
CODEOWNERS
README.md
foo.yaml
pull-request.json

Workflow file

---
name: PR Check values files

on:
  pull_request:
    branches: [master]

jobs:
  pr-tests:
    runs-on: example-base
    steps:
      - name: Run tests against the PR
        uses: example-org/private-github-actions/actions/example-project/umbrella-pr-tests@master

yamllint action inside umbrella-pr-tests

Note that I have edited this file in the cache for debugging purposes.

# /Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-yaml-lint@master/actions/yaml-lint/action.yml 
---
name: "yaml-lint"

author: author@example.com
description: "runs vanilla yamllint on added & changed files"

runs:
  using: "composite"
  steps:
    - name: checkout
      uses: actions/checkout@v2

    - name: debug
      shell: bash
      run: |
        pwd
        ls -al
        yamllint foo.yaml

Expected behaviour

It should yamllint the file foo.yaml.

Actual behaviour

▶ act -e pull-request.json -s GITHUB_TOKEN=ghp_xxxx -P example-base=gha-default-runner:latest pull_request -j pr-tests
[PR Check values files/pr-tests] 🚀  Start image=gha-default-runner:latest
[PR Check values files/pr-tests]   🐳  docker pull image=gha-default-runner:latest platform= username= forcePull=false
[PR Check values files/pr-tests]   🐳  docker create image=gha-default-runner:latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[PR Check values files/pr-tests]   🐳  docker run image=gha-default-runner:latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[PR Check values files/pr-tests]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[PR Check values files/pr-tests] ⭐  Run Run tests against the PR
[PR Check values files/pr-tests]   ☁  git clone 'https://github.com/example-org/private-github-actions' # ref=master
[PR Check values files/pr-tests] Non-terminating error while running 'git clone': some refs were not updated
[PR Check values files/pr-tests]   🐳  docker cp src=/Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/ dst=/var/run/act/actions/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/
[PR Check values files/pr-tests]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/] user= workdir=
[PR Check values files/pr-tests] ⭐  Run yaml-lint values files
[PR Check values files/pr-tests]   ☁  git clone 'https://github.com/example-org/private-github-actions' # ref=master
[PR Check values files/pr-tests] Non-terminating error while running 'git clone': some refs were not updated
[PR Check values files/pr-tests]   🐳  docker cp src=/Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-yaml-lint@master/ dst=/var/run/act/actions/example-org-private-github-actions-actions-yaml-lint@master/
[PR Check values files/pr-tests]   🐳  docker exec cmd=[mkdir -p /var/run/act/actions/example-org-private-github-actions-actions-yaml-lint@master/] user= workdir=
[PR Check values files/pr-tests] ⭐  Run debug
[PR Check values files/pr-tests]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0-composite-0-composite-0.sh] user= workdir=
| /Users/alex.harvey/git/myproject
| total 8
| drwxr-xr-x 2 root root 4096 Apr  3 09:41 .
| drwxr-xr-x 3 root root 4096 Apr  3 09:41 ..
| [Errno 2] No such file or directory: 'foo.yaml'
[PR Check values files/pr-tests]   ❌  Failure - debug
[PR Check values files/pr-tests] exit with `FAILURE`: 255
[PR Check values files/pr-tests]   ❌  Failure - yaml-lint values files
[PR Check values files/pr-tests] exit with `FAILURE`: 255
[PR Check values files/pr-tests]   ❌  Failure - Run tests against the PR
[PR Check values files/pr-tests] exit with `FAILURE`: 255
Error: Job 'pr-tests' failed
Originally created by @alex-harvey-z3q on GitHub (Apr 6, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1112 <!-- - Make sure you are able to reproduce it on the [latest version](https://github.com/nektos/act/releases) - Search the existing issues. - Refer to [README](https://github.com/nektos/act/blob/master/README.md). --> ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - Operating System: Mac OS X - Architecture: ARM - Docker version: 20.10.12 - Docker image used in `act`: custom - `act` version: latest ## Setup ## Contents of project dir ```text ▶ pwd ▶ ls -1 CODEOWNERS README.md foo.yaml pull-request.json ``` ## Workflow file ```yaml --- name: PR Check values files on: pull_request: branches: [master] jobs: pr-tests: runs-on: example-base steps: - name: Run tests against the PR uses: example-org/private-github-actions/actions/example-project/umbrella-pr-tests@master ``` ## yamllint action inside umbrella-pr-tests Note that I have edited this file in the cache for debugging purposes. ```yaml # /Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-yaml-lint@master/actions/yaml-lint/action.yml --- name: "yaml-lint" author: author@example.com description: "runs vanilla yamllint on added & changed files" runs: using: "composite" steps: - name: checkout uses: actions/checkout@v2 - name: debug shell: bash run: | pwd ls -al yamllint foo.yaml ``` ## Expected behaviour <!-- - Describe how whole process should go and finish --> It should yamllint the file `foo.yaml`. ## Actual behaviour <!-- - Describe the issue --> ```text ▶ act -e pull-request.json -s GITHUB_TOKEN=ghp_xxxx -P example-base=gha-default-runner:latest pull_request -j pr-tests [PR Check values files/pr-tests] 🚀 Start image=gha-default-runner:latest [PR Check values files/pr-tests] 🐳 docker pull image=gha-default-runner:latest platform= username= forcePull=false [PR Check values files/pr-tests] 🐳 docker create image=gha-default-runner:latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [PR Check values files/pr-tests] 🐳 docker run image=gha-default-runner:latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [PR Check values files/pr-tests] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [PR Check values files/pr-tests] ⭐ Run Run tests against the PR [PR Check values files/pr-tests] ☁ git clone 'https://github.com/example-org/private-github-actions' # ref=master [PR Check values files/pr-tests] Non-terminating error while running 'git clone': some refs were not updated [PR Check values files/pr-tests] 🐳 docker cp src=/Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/ dst=/var/run/act/actions/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/ [PR Check values files/pr-tests] 🐳 docker exec cmd=[mkdir -p /var/run/act/actions/example-org-private-github-actions-actions-example-project-umbrella-pr-tests@master/] user= workdir= [PR Check values files/pr-tests] ⭐ Run yaml-lint values files [PR Check values files/pr-tests] ☁ git clone 'https://github.com/example-org/private-github-actions' # ref=master [PR Check values files/pr-tests] Non-terminating error while running 'git clone': some refs were not updated [PR Check values files/pr-tests] 🐳 docker cp src=/Users/alex.harvey/.cache/act/example-org-private-github-actions-actions-yaml-lint@master/ dst=/var/run/act/actions/example-org-private-github-actions-actions-yaml-lint@master/ [PR Check values files/pr-tests] 🐳 docker exec cmd=[mkdir -p /var/run/act/actions/example-org-private-github-actions-actions-yaml-lint@master/] user= workdir= [PR Check values files/pr-tests] ⭐ Run debug [PR Check values files/pr-tests] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0-composite-0-composite-0.sh] user= workdir= | /Users/alex.harvey/git/myproject | total 8 | drwxr-xr-x 2 root root 4096 Apr 3 09:41 . | drwxr-xr-x 3 root root 4096 Apr 3 09:41 .. | [Errno 2] No such file or directory: 'foo.yaml' [PR Check values files/pr-tests] ❌ Failure - debug [PR Check values files/pr-tests] exit with `FAILURE`: 255 [PR Check values files/pr-tests] ❌ Failure - yaml-lint values files [PR Check values files/pr-tests] exit with `FAILURE`: 255 [PR Check values files/pr-tests] ❌ Failure - Run tests against the PR [PR Check values files/pr-tests] exit with `FAILURE`: 255 Error: Job 'pr-tests' failed ```
kerem 2026-03-01 21:45:06 +03:00
Author
Owner

@ChristopherHX commented on GitHub (Apr 6, 2022):

Workaround, not tested

---
name: PR Check values files

on:
  pull_request:
    branches: [master]

jobs:
  pr-tests:
    runs-on: example-base
    steps:
      - name: "workaround for act #1112"
        uses: actions/checkout@v2
        if: "false"
      - name: Run tests against the PR
        uses: example-org/private-github-actions/actions/example-project/umbrella-pr-tests@master
<!-- gh-comment-id:1090399267 --> @ChristopherHX commented on GitHub (Apr 6, 2022): **Workaround**, _not tested_ ```yaml --- name: PR Check values files on: pull_request: branches: [master] jobs: pr-tests: runs-on: example-base steps: - name: "workaround for act #1112" uses: actions/checkout@v2 if: "false" - name: Run tests against the PR uses: example-org/private-github-actions/actions/example-project/umbrella-pr-tests@master ```
Author
Owner

@alex-harvey-z3q commented on GitHub (Apr 7, 2022):

@ChristopherHX Confirming that your workaround has succeeded.

<!-- gh-comment-id:1091739479 --> @alex-harvey-z3q commented on GitHub (Apr 7, 2022): @ChristopherHX Confirming that your workaround has succeeded.
Author
Owner

@github-actions[bot] commented on GitHub (May 8, 2022):

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

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

@jsoref commented on GitHub (May 31, 2022):

So, there's code which tries to decide if it should copy the workspace:
github.com/nektos/act@943a0e6eea/pkg/runner/run_context.go (L177-L192)

Which calls:
github.com/nektos/act@943a0e6eea/pkg/runner/run_context.go (L643-L650)

Which doesn't know that a composite step could have steps that could trigger actions/checkout.

In theory, it calls:
github.com/nektos/act@943a0e6eea/pkg/runner/run_context.go (L514-L537)

But, in practice, since it hasn't peeked into the composite action (I don't think that at this point it has downloaded the composite action, and therefore, it can't know what's inside, and of course, a composite action could conditionally perform checkouts -- mine will do that!).

Anyway, moving on, we've now decided that copyWorkspace will be false because no uses: actions/checkout

n.b. some repositories use actions/checkout/, one uses actions/checkout/checkout.

Anyway, eventually when the runtime gets around to the step, it uses this logic:

github.com/nektos/act@943a0e6eea/pkg/runner/step_action_remote.go (L47-L50)

But, it really needs to have access to copyWorkspace from earlier to decide not to use the logic it's using.

<!-- gh-comment-id:1142734289 --> @jsoref commented on GitHub (May 31, 2022): So, there's code which tries to decide if it should copy the workspace: https://github.com/nektos/act/blob/943a0e6eea2f67783018b9d3bc375a6a7dd65ab3/pkg/runner/run_context.go#L177-L192 Which calls: https://github.com/nektos/act/blob/943a0e6eea2f67783018b9d3bc375a6a7dd65ab3/pkg/runner/run_context.go#L643-L650 Which doesn't know that a composite step could have steps that could trigger `actions/checkout`. In theory, it calls: https://github.com/nektos/act/blob/943a0e6eea2f67783018b9d3bc375a6a7dd65ab3/pkg/runner/run_context.go#L514-L537 But, in practice, since it hasn't peeked into the composite action (I don't think that at this point it has downloaded the composite action, and therefore, it can't know what's inside, and of course, a composite action could conditionally perform checkouts -- mine will do that!). Anyway, moving on, we've now decided that `copyWorkspace` will be `false` because no `uses: actions/checkout` n.b. some [repositories use `actions/checkout/`](https://github.com/actions/checkout/network/dependents?package_id=UGFja2FnZS0yOTQyNTU4Njc2), one [uses `actions/checkout/checkout`](https://github.com/actions/checkout/network/dependents?package_id=UGFja2FnZS0zMDEwNjE0NzI4). Anyway, eventually when the runtime gets around to the step, it uses this logic: https://github.com/nektos/act/blob/943a0e6eea2f67783018b9d3bc375a6a7dd65ab3/pkg/runner/step_action_remote.go#L47-L50 But, it really needs to have access to `copyWorkspace` from earlier to decide not to use the logic it's using.
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#632
No description provided.