Act: Unable to resolve v1: reference not found

Created on 20 Jul 2020  ยท  14Comments  ยท  Source: nektos/act

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?

Most helpful comment

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/[email protected] 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

All 14 comments

I have the same issue

This usually means that the version, in your case v1, does not exist. You can try e.g. uses: ruby/[email protected].

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/[email protected] 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'm seeing a similar issue but when using @HEAD as the ref which should generally be valid in a git repo. Works fine when deployed to GH actions.

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\[email protected]\dist\index.js]'
| internal/modules/cjs/loader.js:628
| throw err;
| ^
|
| Error: Cannot find module '/github/workspace/actions\[email protected]\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)

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

cmon, fix it please

@joerodrig Yep, I'm having exactly the same problem. It worked the first couple of times specifying the full tag, but now I'm getting that same error

same issue with symfonycorp/security-checker-action@v2 - working fine on github itself, definitely exists. but locally:

[symfony-security-check/symfony]   โ˜  git clone 'https://github.com/symfonycorp/security-checker-action' # ref=v2
[symfony-security-check/symfony] Unable to resolve v2: reference not found

doing symfonycorp/security-checker-action@038cecb1ee1bf871d1ef43e873f813d900a1125c (038... being the exact commit that tag is on) works. but that ofc shouldn't be a long term solution...

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'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/[email protected] 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.

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/[email protected] 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.

It works the first time after changing to the full version. On the second time, I get the same error.

Is anyone found a fix for ruby setup: Error: reference not found

    - name: Set up Ruby
      uses: ruby/setup-ruby@v1

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quisse picture quisse  ยท  3Comments

kochetkovIT picture kochetkovIT  ยท  4Comments

bltavares picture bltavares  ยท  5Comments

justincy picture justincy  ยท  3Comments

Sygmei picture Sygmei  ยท  3Comments