mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[GH-ISSUE #2418] GITHUB_* variables are empty #1112
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#1112
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 @AndesKrrrrrrrrrrr on GitHub (Aug 7, 2024).
Original GitHub issue: https://github.com/nektos/act/issues/2418
Bug report info
Command used with act
Describe issue
Some
GITHUB_*_REFvariables are empty, even though Act claims on its front page to provide these variables.These are empty:
Link to GitHub repository
https://github.com/AndesKrrrrrrrrrrr/act-MWE/tree/main
Workflow content
Relevant log output
Additional information
No response
@ChristopherHX commented on GitHub (Aug 7, 2024):
..........
Those are empty as run is not an action, please check this against actions/runner
act pull_request exclusive if
-eprovides specfic pr webhook keysplease check against actions/runner when your job runs via push
Do you have some suggestion to get the values? I believe we have documented how the event.json must look like, but that could be invalid didn't verify
What is expected here for refs/pull ? I remember that was undefined while the code has been written and empty was correct
@AndesKrrrrrrrrrrr commented on GitHub (Aug 8, 2024):
Yeah, that makes sense. For now, I don't care about these anyways.
What do you mean by this (
act pull_request exclusive)?We can gather these independent of Github, since we know the base branch, and the current branch. We can set
GITHUB_BASE_REFto the argument of--defaultbranchor create a new flag--basebranch(defaulting to--basebranch).GITHUB_HEAD_REFcan be gathered fromgitas either the current branch name, or the current commit hash.From the docs, though, I've never used it myself or seen it used 🤷
@ChristopherHX commented on GitHub (Aug 10, 2024):
Yes, that is for refs/tag/ and refs/heads/, but we are writing about refs/pull/.
For branch and tag it is implemented.
Stll this has been empty on GH at one point of time for PR's (no push, no anything else), I don't verify such information periodically.
The trigger event name is checked:
Tbh, this looks like to miss pull_request_review and so on
github.com/nektos/act@bda491e406/pkg/model/github_context.go (L203)act push never set's the value from event.json, but I think you don't provide such a file.
To set the value currently just do
act --env GITHUB_HEAD_REF=pr --env GITHUB_BASE_REF=mainthat has no event name filter. But then github.event doesn't mirror the value in the wenhook structuregithub.com/nektos/act@bda491e406/pkg/runner/run_context.go (L880)I don't know it, I would need to guess it. A sha might be an unexpected value here
Not every PR goes to default branch, only most.
As a default fallback it's ok, you can make a pr, but please only for events contain pull_request in their name
As a default fallback it's ok, you can make a pr, but please only for events contain pull_request in their name
@github-actions[bot] commented on GitHub (Feb 7, 2025):
Issue is stale and will be closed in 14 days unless there is new activity
@AndesKrrrrrrrrrrr commented on GitHub (May 21, 2025):
@ChristopherHX, can we please remove the github stalebot? This is still an issue, and won't magically stop being an issue because a bot saw that the issue is "old".
@ChristopherHX commented on GitHub (May 21, 2025):
@AndesKrrrrrrrrrrr What is your point?
The last commit to act removed the stale bot
Disabling stalebot != reopen every issue with label stale.
@AndesKrrrrrrrrrrr commented on GitHub (May 22, 2025):
@ChristopherHX, it was a snarky comment on stalebots. I'm happy to see you've disabled it 😄
My bad on the comment right after it being disabled; funny coincidence.