mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #134] Context unavailable? #91
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#91
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 @jacob-israel-turner on GitHub (Mar 6, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/134
First - wonderful project! I'm tired of pushing hundreds of commits while debugging actions. This will simplify my workflow quite a bit.
One issue I've run into is that the Github context appears to be unavailable within act. Which actually kind of makes sense, given that the actions are not running on Github - but it seems like portions should be easy to shim. Specifically,
github.head_refseems easy to shim in.Even if this isn't possible, is there a way for me to manually provide the context when calling the action? As a temporary workaround, I moved all references to the github context into the env variables, so it's easy to override when testing locally.
@cplee commented on GitHub (Mar 6, 2020):
Much of the GitHub context is implemented, however
head_refandbase_refwere skipped because I wasn't sure how to implement it...where would i pull those from?github.com/nektos/act@4fde7d8865/pkg/runner/run_context.go (L327)@jacob-israel-turner commented on GitHub (Mar 6, 2020):
Actually - it appears ALL context is unavailable - trying to pull
${{ env.BRANCH }}after setting the env at the top of the file returns undefined. Am I consuming it incorrectly?@cplee commented on GitHub (Mar 6, 2020):
env should definitely work...do you have a sample repo you can share?
@cplee commented on GitHub (Mar 6, 2020):
Actually, i think i should pull those
head_refandbase_reffrom the event JSON...then you'd just have to provide that file to act@jacob-israel-turner commented on GitHub (Mar 6, 2020):
Thanks for the quick response @cplee! I can't share a full repo, but here is essentially what I'm running: https://gist.github.com/jacob-israel-turner/5b90ba7a4aaa6d98044581249e957f69
The Log command prints
undefined, and from the behavior of other steps later in the job, it appears that the branch provided to Checkout Branch isundefinedas well.I ran this same file on Github and the branch logs and checks out correctly.
@jacob-israel-turner commented on GitHub (Mar 6, 2020):
That would be awesome - I could provide a JSON event when running
act pull_request, for example? If there's documentation around this, I think it's a great solution.@cplee commented on GitHub (Mar 6, 2020):
dang. you're right, env context has a bug. i was able to reproduce locally
@jacob-israel-turner commented on GitHub (Mar 6, 2020):
Cool. Thanks for the quick turnaround - let me know if there's anything I can do to help debug!
Would you prefer me to open a new issue re:
github.head_refandgithub.base_ref?@cplee commented on GitHub (Mar 6, 2020):
nah, will squash both 🐛
@cplee commented on GitHub (Mar 6, 2020):
fixed on master. will include in next release.
@jacob-israel-turner commented on GitHub (Mar 6, 2020):
Thanks a ton man! Will there be documentation around how to provide an
event.jsontoact? From reading the code, it looks like just having anevent.jsonfile in the working directory might do it. If that's the case, I'm happy to add to the README.@cplee commented on GitHub (Mar 6, 2020):
act -hshows the options...to specify an event file use:act -e my-event.jsonwould love help with README 🙏
@jacob-israel-turner commented on GitHub (Mar 7, 2020):
Just opened two PR's - let me know if you want any changes!
https://github.com/nektos/act/pulls/jacob-israel-turner