File tree 1 file changed +5
-8
lines changed
routers/api/actions/runner
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,12 @@ func pickTask(ctx context.Context, runner *actions_model.ActionRunner) (*runnerv
55
55
56
56
func getSecretsOfTask (ctx context.Context , task * actions_model.ActionTask ) map [string ]string {
57
57
secrets := map [string ]string {}
58
+
59
+ secrets ["GITHUB_TOKEN" ] = task .Token
60
+ secrets ["GITEA_TOKEN" ] = task .Token
61
+
58
62
if task .Job .Run .IsForkPullRequest && task .Job .Run .TriggerEvent != actions_module .GithubEventPullRequestTarget {
59
- // ignore secrets for fork pull request
63
+ // ignore secrets for fork pull request, except GITHUB_TOKEN and GITEA_TOKEN which are automatically generated.
60
64
// for the tasks triggered by pull_request_target event, they could access the secrets because they will run in the context of the base branch
61
65
// see the documentation: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
62
66
return secrets
@@ -82,13 +86,6 @@ func getSecretsOfTask(ctx context.Context, task *actions_model.ActionTask) map[s
82
86
}
83
87
}
84
88
85
- if _ , ok := secrets ["GITHUB_TOKEN" ]; ! ok {
86
- secrets ["GITHUB_TOKEN" ] = task .Token
87
- }
88
- if _ , ok := secrets ["GITEA_TOKEN" ]; ! ok {
89
- secrets ["GITEA_TOKEN" ] = task .Token
90
- }
91
-
92
89
return secrets
93
90
}
94
91
You can’t perform that action at this time.
0 commit comments