feat: support custom GITHUB_RUN_ID, GITHUB_RUN_NUMBER (#369)

* feat: add fromJSON support

* feat: support custom runId and runNumber

* chore: manual update

* chore: lint
This commit is contained in:
Owen 2020-09-23 05:13:29 +08:00 committed by GitHub
parent 04456ad234
commit 1070c58538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

1
.actrc
View File

@ -1 +0,0 @@
-P ubuntu-latest=nektos/act-environments-ubuntu:18.04

View File

@ -15,7 +15,7 @@ build:
.PHONY: test
test:
$(ACT)
$(ACT) -W examples/workflows --verbose
.PHONY: install
install: build

View File

@ -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,