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
 | 
			
		||||
test:
 | 
			
		||||
	$(ACT)
 | 
			
		||||
	$(ACT) -W examples/workflows --verbose
 | 
			
		||||
 | 
			
		||||
.PHONY: install
 | 
			
		||||
install: build
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user