mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-04-26 22:10:29 +08:00
Add run_attempt to context (#126)
Fix https://github.com/go-gitea/gitea/issues/33135 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/act/pulls/126 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
@@ -39,6 +39,9 @@ type GithubContext struct {
|
|||||||
ServerURL string `json:"server_url"`
|
ServerURL string `json:"server_url"`
|
||||||
APIURL string `json:"api_url"`
|
APIURL string `json:"api_url"`
|
||||||
GraphQLURL string `json:"graphql_url"`
|
GraphQLURL string `json:"graphql_url"`
|
||||||
|
|
||||||
|
// For Gitea
|
||||||
|
RunAttempt string `json:"run_attempt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func asString(v interface{}) string {
|
func asString(v interface{}) string {
|
||||||
|
|||||||
@@ -903,6 +903,7 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
|
|||||||
ghc.Event = preset.Event
|
ghc.Event = preset.Event
|
||||||
ghc.RunID = preset.RunID
|
ghc.RunID = preset.RunID
|
||||||
ghc.RunNumber = preset.RunNumber
|
ghc.RunNumber = preset.RunNumber
|
||||||
|
ghc.RunAttempt = preset.RunAttempt
|
||||||
ghc.Actor = preset.Actor
|
ghc.Actor = preset.Actor
|
||||||
ghc.Repository = preset.Repository
|
ghc.Repository = preset.Repository
|
||||||
ghc.EventName = preset.EventName
|
ghc.EventName = preset.EventName
|
||||||
@@ -1065,6 +1066,7 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
|
|||||||
env["GITHUB_SERVER_URL"] = instance
|
env["GITHUB_SERVER_URL"] = instance
|
||||||
env["GITHUB_API_URL"] = instance + "/api/v1" // the version of Gitea is v1
|
env["GITHUB_API_URL"] = instance + "/api/v1" // the version of Gitea is v1
|
||||||
env["GITHUB_GRAPHQL_URL"] = "" // Gitea doesn't support graphql
|
env["GITHUB_GRAPHQL_URL"] = "" // Gitea doesn't support graphql
|
||||||
|
env["GITHUB_RUN_ATTEMPT"] = github.RunAttempt
|
||||||
}
|
}
|
||||||
|
|
||||||
if rc.Config.ArtifactServerPath != "" {
|
if rc.Config.ArtifactServerPath != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user