Add token for getting reusable workflows from local private repos (#38)

Partially fixes https://gitea.com/gitea/act_runner/issues/91

If the repository is private, we need to provide the token to the caller workflows to access the called reusable workflows from the same repository.

Reviewed-on: https://gitea.com/gitea/act/pulls/38
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
Zettat123
2023-04-06 14:16:20 +08:00
committed by Jason Song
parent cfedc518ca
commit 62abf4fe11
2 changed files with 18 additions and 4 deletions

View File

@@ -66,6 +66,14 @@ type Config struct {
JobLoggerLevel *log.Level // the level of job logger
}
func (c Config) GetToken() string {
token := c.Secrets["GITHUB_TOKEN"]
if c.Secrets["GITEA_TOKEN"] != "" {
token = c.Secrets["GITEA_TOKEN"]
}
return token
}
type caller struct {
runContext *RunContext
}