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:
parent
04456ad234
commit
1070c58538
3 changed files with 11 additions and 5 deletions
1
.actrc
1
.actrc
|
@ -1 +0,0 @@
|
||||||
-P ubuntu-latest=nektos/act-environments-ubuntu:18.04
|
|
2
Makefile
2
Makefile
|
@ -15,7 +15,7 @@ build:
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
$(ACT)
|
$(ACT) -W examples/workflows --verbose
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: build
|
install: build
|
||||||
|
|
|
@ -351,13 +351,20 @@ func (rc *RunContext) getGithubContext() *githubContext {
|
||||||
if !ok {
|
if !ok {
|
||||||
token = os.Getenv("GITHUB_TOKEN")
|
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{
|
ghc := &githubContext{
|
||||||
Event: make(map[string]interface{}),
|
Event: make(map[string]interface{}),
|
||||||
EventPath: "/github/workflow/event.json",
|
EventPath: "/github/workflow/event.json",
|
||||||
Workflow: rc.Run.Workflow.Name,
|
Workflow: rc.Run.Workflow.Name,
|
||||||
RunID: "1",
|
RunID: runID,
|
||||||
RunNumber: "1",
|
RunNumber: runNumber,
|
||||||
Actor: rc.Config.Actor,
|
Actor: rc.Config.Actor,
|
||||||
EventName: rc.Config.EventName,
|
EventName: rc.Config.EventName,
|
||||||
Token: token,
|
Token: token,
|
||||||
|
|
Loading…
Reference in a new issue