act icon indicating copy to clipboard operation
act copied to clipboard

actions/checkout: "Input required and not supplied: token" when specifying a ref as input

Open Wenzel opened this issue 1 year ago • 2 comments

Bug report info

Run act --bug-report
  act --bug-report
  shell: /usr/bin/bash -e {0}
act version:            0.2.61
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 4
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$XDG_RUNTIME_DIR/podman/podman.sock
Config files:           
	/home/runner/.config/act/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.14
	Module path:           github.com/nektos/act
	Main version:          (devel)
	Main path:             github.com/nektos/act
	Main checksum:         
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -s -w -X main.version=0.2.61 -X main.commit=361b7e9f1abe9081edf594aa35dede4eab972c70 -X main.date=2024-04-01T02:16:33Z -X main.builtBy=goreleaser
		CGO_ENABLED:          0
		GOARCH:               amd64
		GOOS:                 linux
		GOAMD64:              v1
		vcs:                  git
		vcs.revision:         361b7e9f1abe9081edf594aa35dede4eab972c70
		vcs.time:             2024-04-01T02:16:09Z
		vcs.modified:         false
Docker Engine:
	Engine version:        24.0.9
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Ubuntu 22.04.4 LTS
	OS type:               linux
	OS version:            22.04
	OS arch:               x86_64
	OS kernel:             6.5.0-1017-azure
	OS CPU:                4
	OS memory:             15981 MB
	Security options:
		name=apparmor
		name=seccomp,profile=builtin
		name=cgroupns

Command used with act

act -j test_act

Describe issue

I'm facing an issue with act when running any job that tries to clone a repository with actions/checkout while specifying the ref parameter.

      - uses: actions/checkout@v4
        with:
          ref: act/checkout_ref_error

Link to GitHub repository

https://github.com/Wenzel/bug_report/tree/act/checkout_ref_error

Workflow content

name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - '*'

jobs:
    test_act:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4
              with:
                ref: act/checkout_ref_error

            - name: setup act
              run: |
                curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
                echo "$PWD/bin/" >> $GITHUB_PATH

            - name: Create custom actrc file
              run: |
                mkdir -p $HOME/.config/act
                echo "-P ubuntu-latest=catthehacker/ubuntu:act-latest" >> $HOME/.config/act/actrc
                echo "-P ubuntu-22.04=catthehacker/ubuntu:act-22.04" >> $HOME/.config/act/actrc
                echo "-P ubuntu-20.04=catthehacker/ubuntu:act-20.04" >> $HOME/.config/act/actrc
                echo "-P ubuntu-18.04=catthehacker/ubuntu:act-18.04" >> $HOME/.config/act/actrc
      

            - name: run act
              run: act -j test_act

Relevant log output

Run act -j test_act
time="2024-04-11T10:39:52Z" level=info msg="Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'"
[CI/test_act] 🚀  Start image=catthehacker/ubuntu:act-latest
[CI/test_act]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[CI/test_act] using DockerAuthConfig authentication for docker pull
[CI/test_act]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[CI/test_act]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[CI/test_act]   ☁  git clone 'https://github.com/actions/checkout' # ref=v4
[CI/test_act] ⭐ Run Main actions/checkout@v4
[CI/test_act]   🐳  docker cp src=/home/runner/.cache/act/actions-checkout@v4/ dst=/var/run/act/actions/actions-checkout@v4/
[CI/test_act]   🐳  docker exec cmd=[node /var/run/act/actions/actions-checkout@v4/dist/index.js] user= workdir=
[CI/test_act]   💬  ::debug::GITHUB_WORKSPACE = '/home/runner/work/bug_report/bug_report'
[CI/test_act]   💬  ::debug::qualified repository = 'Wenzel/bug_report'
[CI/test_act]   💬  ::debug::ref = 'act/checkout_ref_error'
[CI/test_act]   💬  ::debug::commit = 'undefined'
[CI/test_act]   💬  ::debug::clean = true
[CI/test_act]   💬  ::debug::filter = undefined
[CI/test_act]   💬  ::debug::fetch depth = 1
[CI/test_act]   💬  ::debug::fetch tags = false
[CI/test_act]   💬  ::debug::show progress = true
[CI/test_act]   💬  ::debug::lfs = false
[CI/test_act]   💬  ::debug::submodules = false
[CI/test_act]   💬  ::debug::recursive submodules = false
[CI/test_act]   ❗  ::error::Input required and not supplied: token
[CI/test_act]   ❌  Failure - Main actions/checkout@v4
[CI/test_act] exitcode '1': failure
[CI/test_act] ⭐ Run Post actions/checkout@v4
[CI/test_act]   🐳  docker exec cmd=[node /var/run/act/actions/actions-checkout@v4/dist/index.js] user= workdir=
[CI/test_act]   ✅  Success - Post actions/checkout@v4
[CI/test_act] 🏁  Job failed
Error: Job 'test_act' failed
Error: Process completed with exit code 1.

Additional information

When the ref parameter is removed, act works fine and actions/checkout manages to clone the repo. Link the failed workflow run for reproducibility: https://github.com/Wenzel/bug_report/actions/runs/8645464938/job/23702674057

Thanks for act !

Wenzel avatar Apr 11 '24 10:04 Wenzel

When the ref parameter is removed, act works fine and actions/checkout manages to clone the repo.

Actually no, actions/checkout is just replaced by docker cp in that case.

act -s GITHUB_TOKEN should make it possible to run it with a user supplied token, created a invalid token causes more errors than an empty one

ChristopherHX avatar Apr 11 '24 12:04 ChristopherHX

@Wenzel Because of your bug and ChrstopherHX's comment, I searched the usage guide and found a section dealing with this. On the Usage page https://nektosact.com/usage/index.html search for GITHUB_TOKEN.

It's a bit counter-intuitive to me that this case needs an auth token, but if you have the gh cli installed then the solution's this simple act -s GITHUB_TOKEN="$(gh auth token)"

gwynforthewyn avatar May 12 '24 23:05 gwynforthewyn

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

github-actions[bot] avatar Nov 09 '24 00:11 github-actions[bot]