mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #2627] event file overrides github.ref but not github.ref_name #1193
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#1193
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Dr-Electron on GitHub (Jan 21, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2627
Bug report info
Command used with act
Describe issue
I have an event.json file with the following content:
If I look at the GitHub context,
github.refis set todevelop, butgithub.ref_nameis not. Seems inconsistent to me.Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
No response
@LauH1987 commented on GitHub (Jul 2, 2025):
I'm still new to
actand GitHub Actions, but something I learned is that the event json in general (partially) follows the schema of the Webhook payload in the GitHub API. In your case you're simulating apushevent, so the fields that are normally available to you are documented here.actdoesn't require you to fill out all the required fields, and it also supports adding extra fields like thegithub.event.actfield in the Skipping Jobs example in the docs.However setting
ref_namein the event is not supported. You can see howactsets theref_namefrom therefhere.If you manually want to set the
ref_name, you can do so by adding it to the environment. The default available environment variables are documented in the GitHub Action Docs here.As you can see you need to set the
GITHUB_REF_NAMEenvironment variable. So to make your example work, first remove theref_namefrom the event:event.jsonNext you add
GITHUB_REF_NAMEto the environment. This can be done in multiple ways:The first way is to use the
--envargument like--env GITHUB_REF_NAME=developwhen runningact, or to put it in the.actrcfile.The second way is to add it to an envrionment file. By default
actwill look for the filename.env, but if you want a different file you can use the--env-fileargument.I ran your code with the following
.envfile:And it gave me the output you're looking for (I have shortened the output below):