@@ -19,28 +19,29 @@ tasks:
1919 ' tasks_for == "github-push" ' : ' ${event.pusher.email}'
2020 ' tasks_for == "github-release" ' :
' [email protected] ' 2121 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.user.login}@users.noreply.github.com'
22- ' tasks_for in ["cron", "action"] ' : ' ${tasks_for}@noreply.mozilla.org'
22+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${tasks_for}@noreply.mozilla.org'
2323 baseRepoUrl :
2424 $switch :
2525 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.base.repo.html_url}'
2626 ' tasks_for in ["cron", "action"] ' : ' ${repository.url}'
27+ ' tasks_for == "pr-action" ' : ' ${repository.base_url}'
2728 $default : ' ${event.repository.html_url}'
2829 repoUrl :
2930 $switch :
3031 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.head.repo.html_url}'
31- ' tasks_for in ["cron", "action"] ' : ' ${repository.url}'
32+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${repository.url}'
3233 $default : ' ${event.repository.html_url}'
3334 project :
3435 $switch :
3536 ' tasks_for in ["github-push", "github-release"] ' : ' ${event.repository.name}'
3637 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.head.repo.name}'
37- ' tasks_for in ["cron", "action"] ' : ' ${repository.project}'
38+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${repository.project}'
3839 head_branch :
3940 $switch :
4041 ' tasks_for[:19] == "github-pull-request" ' : ${event.pull_request.head.ref}
4142 ' tasks_for == "github-push" ' : ${event.ref}
4243 ' tasks_for == "github-release" ' : ' ${event.release.target_commitish}'
43- ' tasks_for in ["action", "cron "] ' : ' ${push.branch}'
44+ ' tasks_for in ["cron", " action", "pr-action "] ' : ' ${push.branch}'
4445 base_ref :
4546 $switch :
4647 ' tasks_for[:19] == "github-pull-request" ' : ${event.pull_request.base.ref}
@@ -52,29 +53,29 @@ tasks:
5253 ' tasks_for == "github-push" && event.base_ref ' : ${event.base_ref}
5354 ' tasks_for == "github-push" && !(event.base_ref) ' : ${event.ref}
5455 ' tasks_for == "github-release" ' : ${event.release.tag_name}
55- ' tasks_for in ["cron", "action"] ' : ' ${push.branch}'
56+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${push.branch}'
5657 head_ref :
5758 $switch :
5859 ' tasks_for[:19] == "github-pull-request" ' : ${event.pull_request.head.ref}
5960 ' tasks_for == "github-push" ' : ${event.ref}
60- ' tasks_for in ["cron", "action"] ' : ' ${push.branch}'
61+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${push.branch}'
6162 ' tasks_for == "github-release" ' : ${event.release.tag_name}
6263 base_sha :
6364 $switch :
6465 ' tasks_for == "github-push" ' : ' ${event.before}'
6566 ' tasks_for == "github-release" ' : ' ${event.release.target_commitish}'
6667 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.base.sha}'
67- ' tasks_for in ["cron", "action"] ' : ' ${push.revision}'
68+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${push.revision}'
6869 head_sha :
6970 $switch :
7071 ' tasks_for == "github-push" ' : ' ${event.after}'
7172 ' tasks_for[:19] == "github-pull-request" ' : ' ${event.pull_request.head.sha}'
72- ' tasks_for in ["cron", "action"] ' : ' ${push.revision}'
73+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${push.revision}'
7374 ' tasks_for == "github-release" ' : ' ${event.release.tag_name}'
7475 ownTaskId :
7576 $switch :
7677 ' "github" in tasks_for ' : {$eval: as_slugid("decision_task")}
77- ' tasks_for in ["cron", "action"] ' : ' ${ownTaskId}'
78+ ' tasks_for in ["cron", "action", "pr-action" ] ' : ' ${ownTaskId}'
7879 pullRequestAction :
7980 $switch :
8081 ' tasks_for[:19] == "github-pull-request" ' : ${event.action}
8788 $eval : ' tasks_for[:19] == "github-pull-request"'
8889 in :
8990 $if : >
90- tasks_for in ["action", "cron"]
91+ tasks_for in ["action", "pr-action", " cron"]
9192 || (tasks_for == "github-release" && releaseAction == "published")
9293 || (tasks_for == "github-push" && head_branch == "refs/heads/main")
9394 || (tasks_for == "github-release" && )
@@ -106,9 +107,9 @@ tasks:
106107 then : {$eval: 'head_ref[11:]'}
107108 else : ${head_ref}
108109 in :
109- taskId : {$if: 'tasks_for != "action"', then: '${ownTaskId}'}
110+ taskId : {$if: 'tasks_for != "action" && tasks_for != "pr-action" ', then: '${ownTaskId}'}
110111 taskGroupId :
111- $if : ' tasks_for == "action"'
112+ $if : ' tasks_for == "action" || tasks_for == "pr-action" '
112113 then :
113114 ' ${action.taskGroupId}'
114115 else :
@@ -132,6 +133,12 @@ tasks:
132133 ${action.description}
133134
134135 Action triggered by clientID `${clientId}`
136+ ' tasks_for == "pr-action" ' :
137+ name : " PR action: ${action.title}"
138+ description : |
139+ ${action.description}
140+
141+ PR action triggered by clientID `${clientId}`
135142 $default :
136143 name : " Decision Task for cron job ${cron.job_name}"
137144 description : ' Created by a [cron task](https://firefox-ci-tc.services.mozilla.com/tasks/${cron.task_id})'
@@ -144,7 +151,7 @@ tasks:
144151 ' tasks_for == "github-push" || isPullRequest ' :
145152 createdForUser : " ${ownerEmail}"
146153 kind : decision-task
147- ' tasks_for == "action" ' :
154+ ' tasks_for == "action" || tasks_for == "pr-action" ' :
148155 createdForUser : ' ${ownerEmail}'
149156 kind : ' action-callback'
150157 ' tasks_for == "cron" ' :
@@ -153,7 +160,7 @@ tasks:
153160 routes :
154161 $flatten :
155162 - checks
156- - {$if: '!isPullRequest', then: ["tc-treeherder.v2.${project}.${head_sha}"], else: []}
163+ - {$if: '!isPullRequest && tasks_for != "pr-action" ', then: ["tc-treeherder.v2.${project}.${head_sha}"], else: []}
157164 - $switch :
158165 ' tasks_for == "github-push" ' :
159166 - " index.${trustDomain}.v2.${project}.latest.taskgraph.decision"
@@ -177,6 +184,8 @@ tasks:
177184 - ' assume:repo:github.com/${event.pull_request.base.repo.full_name}:${tasks_for[7:]}'
178185 ' tasks_for == "action" ' :
179186 - ' assume:repo:${repoUrl[8:]}:action:${action.action_perm}'
187+ ' tasks_for == "pr-action" ' :
188+ - ' assume:repo:${baseRepoUrl[8:]}:pr-action:${action.action_perm}'
180189 $default :
181190 - ' assume:repo:${repoUrl[8:]}:cron:${cron.job_name}'
182191
@@ -217,7 +226,7 @@ tasks:
217226 - $if : ' isPullRequest'
218227 then :
219228 TASKGRAPH_PULL_REQUEST_NUMBER : ' ${event.pull_request.number}'
220- - $if : ' tasks_for == "action"'
229+ - $if : ' tasks_for == "action" || tasks_for == "pr-action" '
221230 then :
222231 ACTION_TASK_GROUP_ID : ' ${action.taskGroupId}' # taskGroupId of the target task
223232 ACTION_TASK_ID : {$json: {$eval: 'taskId'}} # taskId of the target task (JSON-encoded)
@@ -244,7 +253,7 @@ tasks:
244253 - $let :
245254 extraArgs : {$if: 'tasks_for == "cron"', then: '${cron.quoted_args}', else: ''}
246255 in :
247- $if : ' tasks_for == "action"'
256+ $if : ' tasks_for == "action" || tasks_for == "pr-action" '
248257 then : >
249258 cd /builds/worker/checkouts/src &&
250259 ln -s /builds/worker/artifacts artifacts &&
@@ -294,14 +303,14 @@ tasks:
294303 - $switch :
295304 ' tasks_for in ["github-push", "github-release"] || isPullRequest ' :
296305 symbol : D
297- ' tasks_for == "action" ' :
306+ ' tasks_for == "action" || tasks_for == "pr-action" ' :
298307 groupName : ' action-callback'
299308 groupSymbol : AC
300309 symbol : " ${action.symbol}"
301310 $default :
302311 groupSymbol : cron
303312 symbol : " ${cron.job_symbol}"
304- - $if : ' tasks_for == "action"'
313+ - $if : ' tasks_for == "action" || tasks_for == "pr-action" '
305314 then :
306315 parent : ' ${action.taskGroupId}'
307316 action :
0 commit comments