[GH-ISSUE #969] Issue: $GITHUB_REF incorrectly set for release event #568

Closed
opened 2026-03-01 21:44:34 +03:00 by kerem · 1 comment
Owner

Originally created by @percygrunwald on GitHub (Jan 27, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/969

System information

  • Operating System: macOS
  • Architecture: x64 (64-bit)
  • Apple M1: no
  • Docker version: 20.10.11
  • Docker image used in act: ghcr.io/catthehacker/ubuntu:act-latest
  • act version: mod github.com/nektos/act v0.2.25 h1:RuPuzaG3qwPaeHHyTWw57LwG2ze6M+Gd/5SCVFDD5Yo=

Setup and steps to reproduce

$ tree .github
.github
├── events
│   └── release.json
└── workflows
    └── ci.yml

2 directories, 2 files
# github/workflows/ci.yml 
on: release
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - run: echo "${GITHUB_REF}"
# .github/events/release.json 
{
  "action": "published",
  "release": {
    "tag_name": "v0.0.1"
  }
}
$ git add . && git commit -m "Initial commit"
$ git remote add origin http://example.com/test.git
$ act release --eventpath .github/events/release.json 

Expected behaviour

echo $GITHUB_REF should print the value of release.tag_name from the event: v1.0.0.

Actual behaviour

echo $GITHUB_REF prints refs/heads/master:

$ act release --eventpath .github/events/release.json 
[ci.yml/build] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[ci.yml/build]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[ci.yml/build]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ci.yml/build]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ci.yml/build]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[ci.yml/build] ⭐  Run echo "${GITHUB_REF}"
[ci.yml/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/percy/Code/nektos_act_test/workflow/0] user= workdir=
| refs/heads/master
[ci.yml/build]   ✅  Success - echo "${GITHUB_REF}"

Thank you for your help.

Originally created by @percygrunwald on GitHub (Jan 27, 2022). Original GitHub issue: https://github.com/nektos/act/issues/969 ## System information - Operating System: macOS - Architecture: x64 (64-bit) - Apple M1: no - Docker version: 20.10.11 - Docker image used in `act`: `ghcr.io/catthehacker/ubuntu:act-latest` - `act` version: `mod github.com/nektos/act v0.2.25 h1:RuPuzaG3qwPaeHHyTWw57LwG2ze6M+Gd/5SCVFDD5Yo=` ## Setup and steps to reproduce ``` $ tree .github .github ├── events │ └── release.json └── workflows └── ci.yml 2 directories, 2 files ``` ``` # github/workflows/ci.yml on: release jobs: build: runs-on: ubuntu-latest steps: - run: echo "${GITHUB_REF}" ``` ``` # .github/events/release.json { "action": "published", "release": { "tag_name": "v0.0.1" } } ``` ``` $ git add . && git commit -m "Initial commit" $ git remote add origin http://example.com/test.git ``` ``` $ act release --eventpath .github/events/release.json ``` ## Expected behaviour `echo $GITHUB_REF` should print the value of `release.tag_name` from the event: `v1.0.0`. ## Actual behaviour `echo $GITHUB_REF` prints `refs/heads/master`: ``` $ act release --eventpath .github/events/release.json [ci.yml/build] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest [ci.yml/build] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false [ci.yml/build] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ci.yml/build] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ci.yml/build] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [ci.yml/build] ⭐ Run echo "${GITHUB_REF}" [ci.yml/build] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /Users/percy/Code/nektos_act_test/workflow/0] user= workdir= | refs/heads/master [ci.yml/build] ✅ Success - echo "${GITHUB_REF}" ``` Thank you for your help.
kerem 2026-03-01 21:44:34 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@percygrunwald commented on GitHub (Jan 27, 2022):

Ah, this is already fixed on master, sorry for the noise.

$ go install github.com/nektos/act@master
go: downloading github.com/nektos/act v0.2.26-0.20220126171242-557dc755b8fe
...
$ act release --eventpath .github/events/release.json 
[ci.yml/build] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[ci.yml/build]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false
[ci.yml/build]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ci.yml/build]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[ci.yml/build]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[ci.yml/build] ⭐  Run echo "${GITHUB_REF}"
[ci.yml/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
| v0.0.1
[ci.yml/build]   ✅  Success - echo "${GITHUB_REF}"
<!-- gh-comment-id:1022846205 --> @percygrunwald commented on GitHub (Jan 27, 2022): Ah, this is already fixed on master, sorry for the noise. ``` $ go install github.com/nektos/act@master go: downloading github.com/nektos/act v0.2.26-0.20220126171242-557dc755b8fe ... ``` ``` $ act release --eventpath .github/events/release.json [ci.yml/build] 🚀 Start image=ghcr.io/catthehacker/ubuntu:act-latest [ci.yml/build] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=false [ci.yml/build] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ci.yml/build] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [ci.yml/build] 🐳 docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir= [ci.yml/build] ⭐ Run echo "${GITHUB_REF}" [ci.yml/build] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir= | v0.0.1 [ci.yml/build] ✅ Success - echo "${GITHUB_REF}" ```
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#568
No description provided.