nektos / act

Run your GitHub Actions locally 🚀
https://nektosact.com
MIT License
55.61k stars 1.39k forks source link

Act fails when tag doesn't start with "v" #2539

Open GammaGames opened 1 day ago

GammaGames commented 1 day ago

Bug report info

act version:            0.2.68
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Build info:
        Go version:            go1.21.13
        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.68 -X main.commit=03a4480cd024910c88c8946da8d589b9ef0c6660 -X main.date=2024-10-01T02:31:47Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         03a4480cd024910c88c8946da8d589b9ef0c6660
                vcs.time:             2024-10-01T02:31:30Z
                vcs.modified:         false
Docker Engine:
        Engine version:        27.3.1
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    elementary OS 7.1 Horus
        OS type:               linux
        OS version:            7.1
        OS arch:               x86_64
        OS kernel:             6.8.0-48-generic
        OS CPU:                8
        OS memory:             15705 MB
        Security options:
                name=apparmor
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act

Describe issue

Act incorrectly reports:

Unable to resolve action http://github.com/mad9000/actions-find-and-replace-string@5, the provided ref 5 is the shortened version of a commit SHA, which is not supported. Please use the full commit SHA 51ad904dfdc3aea1a4f06e925a18a4cfddae7041 instead

The workflow is valid: https://github.com/mad9000/actions-find-and-replace-string/blob/main/.github/workflows/main.yml

Link to GitHub repository

https://github.com/mad9000/actions-find-and-replace-string

Workflow content

on: [push]

jobs:
  find-and-replace-job:
    runs-on: ubuntu-latest
    name: 'Find and replace on a string'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Run find-and-replace to remove refs/heads/
        uses: mad9000/actions-find-and-replace-string@5
        id: findandreplace
        with:
          source: ${{ github.ref }}
          find: 'refs/heads/'
          replace: ''
      - name: Get the above output
        run: echo "The replaced value is ${{ steps.findandreplace.outputs.value }}"
      - name: Run find-and-replace to remove slashes
        uses: mad9000/actions-find-and-replace-string@5
        id: findandreplace2
        with:
          source: ${{ steps.findandreplace.outputs.value }}
          find: '/'
          replace: '-'
      - name: Get the final output
        run: echo "The replaced value is ${{ steps.findandreplace2.outputs.value }}"

Relevant log output

☁  git clone 'http://github.com/mad9000/actions-find-and-replace-string' # ref=5
  cloning http://github.com/mad9000/actions-find-and-replace-string to /root/.cache/act/bb58a4f8ee533c336ce085aec3674f7930cd02c237df00206beaa4e78ed0a721
Unable to resolve action `http://github.com/mad9000/actions-find-and-replace-string@5`, the provided ref `5` is the shortened version of a commit SHA, which is not supported. Please use the full commit SHA `51ad904dfdc3aea1a4f06e925a18a4cfddae7041` instead

Additional information

No response

ChristopherHX commented 11 hours ago

Is this already fixed in https://github.com/nektos/act/pull/2509? (at least I didn't migrate the error, while I'm now unshure if the test for this feature didn't work in my PR) there is --use-new-action-cache in your version as well to apply the change, but it has known defects (e.g. with docker actions) until my mentioned pr and is disabled by default.

I wonder what will GitHub actually plan with immutable actions, they already published an action that is used to publish them