Skip to content

Commit

Permalink
feat: support custom GITHUB_RUN_ID, GITHUB_RUN_NUMBER (nektos#369)
Browse files Browse the repository at this point in the history
* feat: add fromJSON support

* feat: support custom runId and runNumber

* chore: manual update

* chore: lint
  • Loading branch information
theowenyoung authored Sep 22, 2020
1 parent 04456ad commit 1070c58
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion .actrc
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
-P ubuntu-latest=nektos/act-environments-ubuntu:18.04
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build:

.PHONY: test
test:
$(ACT)
$(ACT) -W examples/workflows --verbose

.PHONY: install
install: build
Expand Down
13 changes: 10 additions & 3 deletions pkg/runner/run_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,20 @@ func (rc *RunContext) getGithubContext() *githubContext {
if !ok {
token = os.Getenv("GITHUB_TOKEN")
}

runID := rc.Config.Env["GITHUB_RUN_ID"]
if(runID == ""){
runID = "1"
}
runNumber := rc.Config.Env["GITHUB_RUN_NUMBER"]
if(runNumber == ""){
runNumber = "1"
}
ghc := &githubContext{
Event: make(map[string]interface{}),
EventPath: "/github/workflow/event.json",
Workflow: rc.Run.Workflow.Name,
RunID: "1",
RunNumber: "1",
RunID: runID,
RunNumber: runNumber,
Actor: rc.Config.Actor,
EventName: rc.Config.EventName,
Token: token,
Expand Down

0 comments on commit 1070c58

Please sign in to comment.