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:
		
							
								
								
									
										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,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user