act: Unable to resolve v1: reference not found

Hi! It’s the first time I’m working with github actions and I saw this to test them locally.

I have this workflow

name: Test-Build-Publish

on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/cache@v1
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile') }}
        restore-keys: |
          ${{ runner.os }}-gem-
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: 2.4
    - name: Install dependencies
      run: bundle check || bundle install --jobs=4 --retry=3 --path vendor/bundle
    - name: Run tests
      run: bundle exec rake
    - name: Upload artifact
      uses: actions/upload-artifact@v2
      with:
        name: test-results
        path: test-results
  build:
    name: "Build Gem"
    needs: test
    runs-on: ubuntu-20.04
    steps:
    - name: Build
      run: echo 'building'
  publish:
    name: Publish Gem
    needs: build
    runs-on: ubuntu-20.04
    steps:
    - name: Publish
      run: echo 'publish'

But I’m having this error when running act

➜  fastlane-plugin-json git:(master) act
[Test-Build-Publish/test       ] 🚀  Start image=node:12.6-buster-slim
[Test-Build-Publish/test       ]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test-Build-Publish/test       ]   🐳  docker cp src=/Users/martin.gonzalez/Desktop/fastlane-plugin-json/. dst=/github/workspace
[Test-Build-Publish/test       ] ⭐  Run actions/checkout@v2
[Test-Build-Publish/test       ]   ✅  Success - actions/checkout@v2
[Test-Build-Publish/test       ] ⭐  Run actions/cache@v1
[Test-Build-Publish/test       ]   ☁  git clone 'https://github.com/actions/cache' # ref=v1
[Test-Build-Publish/test       ]   🐳  docker cp src=/Users/martin.gonzalez/.cache/act/actions-cache@v1 dst=/actions/
[Test-Build-Publish/test       ]   💬  ::debug::Cache Path: /github/workspace/vendor/bundle
[Test-Build-Publish/test       ]   ❓  ::save-state name=CACHE_KEY,::Linux-gem-df84e4ade202d5cd4280a79acfea544a600ef73f1b39b2097a1f660ed64dd2a7
[Test-Build-Publish/test       ]   💬  ::debug::Resolved Keys:
[Test-Build-Publish/test       ]   💬  ::debug::["Linux-gem-df84e4ade202d5cd4280a79acfea544a600ef73f1b39b2097a1f660ed64dd2a7","Linux-gem-"]
[Test-Build-Publish/test       ]   💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[Test-Build-Publish/test       ]   💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
| [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache.
[Test-Build-Publish/test       ]   ⚙  ::set-output:: cache-hit=false
[Test-Build-Publish/test       ]   ✅  Success - actions/cache@v1
[Test-Build-Publish/test       ] ⭐  Run Set up Ruby
[Test-Build-Publish/test       ]   ☁  git clone 'https://github.com/ruby/setup-ruby' # ref=v1
[Test-Build-Publish/test       ] Unable to resolve v1: reference not found
[Test-Build-Publish/test       ]   ❌  Failure - Set up Ruby
Error: reference not found

If I run git clone 'https://github.com/ruby/setup-ruby' # ref=v1 it succeed. Should I configure something? A github token to an Env variable or something?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 23
  • Comments: 28 (8 by maintainers)

Most upvoted comments

I came across this issue after having act interrupted mid-way through a job and leaving the act’s cache in a bad state. I ran rm -rf ~/.cache/act and was able to continue working

I’m seeing something similar using actions-rs/toolchain@v1. If pushed to Github, the Action works as intended; running act locally, I see Unable to resolve v1: reference not found.

If I change this to actions-rs/toolchain@v1.0.6 then act works as expected.

As far as I can see, both v1.0.6 and v1 are valid references: https://github.com/actions-rs/toolchain/tags

I added commits on #471 and #433 and they were merged (but they aren’t released yet), so I’m expecting this issue will be fixed.

cmon, fix it please

I’m seeing this failure in Act but not on GitHub, too. I’m using cypress-io/github-action. Using @v2 works on GitHub. The repo does not have a v2 tag, so that fails with reference not found. It had a v2.2.2 tag, which Act can find, but then it fails with this:

[web redesign functional test/tryit-2] Exec command ‘[node \actions\cypress-io-github-action@v2.2.2\dist\index.js]’ | internal/modules/cjs/loader.js:628 | throw err; | ^ | | Error: Cannot find module ‘/github/workspace/\actions\cypress-io-github-action@v2.2.2\dist\index.js’ | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15) | at Function.Module._load (internal/modules/cjs/loader.js:527:27) | at Function.Module.runMain (internal/modules/cjs/loader.js:839:10) | at internal/main/run_main_module.js:17:11 { | code: ‘MODULE_NOT_FOUND’, | requireStack: [] | }

(marking the output above as code mangled it badly, so I bolded instead)

Seeing the same issue with the setup-python action:

[Tests/build-3] ⭐  Run Set up Python ${{ matrix.python-version }}
[Tests/build-3]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v1
[Tests/build-3] Unable to resolve v1: reference not found

Running git clone 'https://github.com/actions/setup-python' # ref=v1 locally is successful.

Github actions yaml file can be found here: https://github.com/plamere/spotipy/blob/master/.github/workflows/pythonapp.yml

This usually means that the version, in your case v1, does not exist. You can try e.g. uses: ruby/setup-ruby@v1.40.0.

I’m seeing something similar using actions-rs/toolchain@v1. If pushed to Github, the Action works as intended; running act locally, I see Unable to resolve v1: reference not found.

If I change this to actions-rs/toolchain@v1.0.6 then act works as expected.

As far as I can see, both v1.0.6 and v1 are valid references: https://github.com/actions-rs/toolchain/tags

I used the exact version and resolved.

The issue occurs if v1, v2 refs are branches, not tags. But yes, it’s very annoying and needs to be fixed.

The same is https://github.com/nektos/act/issues/234

@cplee could you look into? Thanks so much

I was having this issue as well on Act. I got around it by forking the repo and creating a new tag off of the head of the latest release(v1.40.0) and creating a new tag that was just v1, which was recognized. See this release tag. My guess is that this parser code is looking for a base version tag(ie. v1), which it’s not finding because the base v1 tag here is v1.0.0

I’m not 100% sure if this worked as a full workaround though, because I’m getting a new issue when attempting to install my specified ruby version now:

[Rails Unit Tests/build]   ❓  ::group::Extracting Ruby
| [command]/bin/tar -xz -C /github/home/.rubies -f /tmp/e24aa2b2-f52a-435c-9cde-66bd2b89b387
| Took   0.25 seconds
[Rails Unit Tests/build]   ❓  ::endgroup::
[Rails Unit Tests/build]   ⚙  ::set-env:: PATH=/github/home/.rubies/ruby-2.6.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[Rails Unit Tests/build]   ❓  ::group::Installing Bundler
| Using Bundler 2 from Gemfile.lock BUNDLED WITH 2.1.4
| [command]/github/home/.rubies/ruby-2.6.6/bin/gem install bundler -v ~> 2 --no-document
| Took   0.00 seconds
[Rails Unit Tests/build]   ❓  ::endgroup::
[Rails Unit Tests/build]   ❗  ::error::There was an error when attempting to execute the process '/github/home/.rubies/ruby-2.6.6/bin/gem'. This may indicate the process failed to start. Error: spawn /github/home/.rubies/ruby-2.6.6/bin/gem ENOENT
[Rails Unit Tests/build]   ❌  Failure - joerodrig/setup-ruby@v1