@@ -13,15 +13,25 @@ permissions:
1313 issues : write
1414 pull-requests : write
1515
16+ env :
17+ STATUS_COMMENT_MARKER : <!-- new-event-intake-status -->
18+
1619jobs :
17- create-event-pr :
20+ process-submission :
1821 if : contains(github.event.issue.labels.*.name, 'new event')
1922 runs-on : ubuntu-latest
2023 timeout-minutes : 10
2124 env :
2225 PCD_TEAM_ASSIGNEES : ${{ vars.PCD_TEAM_ASSIGNEES }}
2326 PCD_TEAM_REVIEWERS : ${{ vars.PCD_TEAM_REVIEWERS }}
24- STATUS_COMMENT_MARKER : <!-- new-event-intake-status -->
27+ outputs :
28+ valid : ${{ steps.generate.outputs.valid }}
29+ branch : ${{ steps.generate.outputs.branch }}
30+ commit_message : ${{ steps.generate.outputs.commit_message }}
31+ pr_title : ${{ steps.generate.outputs.pr_title }}
32+ pr_body_path : ${{ steps.generate.outputs.pr_body_path }}
33+ validation_comment_path : ${{ steps.generate.outputs.validation_comment_path }}
34+ event_name : ${{ steps.generate.outputs.event_name }}
2535 steps :
2636 - name : Label and assign intake issue
2737 uses : actions/github-script@v8
@@ -79,18 +89,50 @@ jobs:
7989 run : |
8090 echo "valid=${{ steps.generate.outputs.valid }}"
8191 echo "branch=${{ steps.generate.outputs.branch }}"
92+ echo "event_name=${{ steps.generate.outputs.event_name }}"
8293 echo "validation_comment_path=${{ steps.generate.outputs.validation_comment_path }}"
8394 echo "pr_body_path=${{ steps.generate.outputs.pr_body_path }}"
84- - name : Upsert validation status comment
95+ - name : Upload event files artifact
96+ if : steps.generate.outputs.valid == 'true'
97+ uses : actions/upload-artifact@v4
98+ with :
99+ name : event-files-${{ github.event.issue.number }}
100+ path : pcd-website/src/content/events/
101+ retention-days : 1
102+ - name : Upload PR body artifact
103+ if : steps.generate.outputs.valid == 'true'
104+ uses : actions/upload-artifact@v4
105+ with :
106+ name : pr-body-${{ github.event.issue.number }}
107+ path : ${{ steps.generate.outputs.pr_body_path }}
108+ retention-days : 1
109+ - name : Upload validation comment artifact
85110 if : steps.generate.outputs.valid == 'false'
111+ uses : actions/upload-artifact@v4
112+ with :
113+ name : validation-comment-${{ github.event.issue.number }}
114+ path : ${{ steps.generate.outputs.validation_comment_path }}
115+ retention-days : 1
116+
117+ handle-validation-failure :
118+ needs : process-submission
119+ if : needs.process-submission.outputs.valid == 'false'
120+ runs-on : ubuntu-latest
121+ timeout-minutes : 5
122+ steps :
123+ - name : Download validation comment artifact
124+ uses : actions/download-artifact@v4
125+ with :
126+ name : validation-comment-${{ github.event.issue.number }}
127+ path : /tmp/validation-comment
128+ - name : Upsert validation status comment
86129 uses : actions/github-script@v8
87- env :
88- VALIDATION_COMMENT_PATH : ${{ steps.generate.outputs.validation_comment_path }}
89130 with :
90131 script : |
91132 const fs = require('fs');
92133 const marker = process.env.STATUS_COMMENT_MARKER;
93- const body = `${marker}\n${fs.readFileSync(process.env.VALIDATION_COMMENT_PATH, 'utf8')}`;
134+ const commentPath = `/tmp/validation-comment/new-event-${context.issue.number}-validation.md`;
135+ const body = `${marker}\n${fs.readFileSync(commentPath, 'utf8')}`;
94136 const { data: comments } = await github.rest.issues.listComments({
95137 owner: context.repo.owner,
96138 repo: context.repo.repo,
@@ -115,27 +157,57 @@ jobs:
115157 body,
116158 });
117159 }
160+
161+ create-pr :
162+ needs : process-submission
163+ if : needs.process-submission.outputs.valid == 'true'
164+ runs-on : ubuntu-latest
165+ timeout-minutes : 10
166+ outputs :
167+ pull-request-number : ${{ steps.create_pr.outputs.pull-request-number }}
168+ pull-request-url : ${{ steps.create_pr.outputs.pull-request-url }}
169+ steps :
170+ - uses : actions/checkout@v6
171+ with :
172+ ref : ${{ github.event.repository.default_branch }}
173+ - name : Download event files artifact
174+ uses : actions/download-artifact@v4
175+ with :
176+ name : event-files-${{ github.event.issue.number }}
177+ path : pcd-website/src/content/events/
178+ - name : Download PR body artifact
179+ uses : actions/download-artifact@v4
180+ with :
181+ name : pr-body-${{ github.event.issue.number }}
182+ path : /tmp/pr-body
118183 - name : Create pull request
119- if : steps.generate.outputs.valid == 'true'
120184 id : create_pr
121185 uses : peter-evans/create-pull-request@v8
122186 with :
123187 token : ${{ secrets.GITHUB_TOKEN }}
124- branch : ${{ steps.generate .outputs.branch }}
188+ branch : ${{ needs.process-submission .outputs.branch }}
125189 delete-branch : true
126190 add-paths : |
127191 pcd-website/src/content/events/**
128- commit-message : ${{ steps.generate.outputs.commit_message }}
129- title : ${{ steps.generate.outputs.pr_title }}
130- body-path : ${{ steps.generate.outputs.pr_body_path }}
192+ commit-message : ${{ needs.process-submission.outputs.commit_message }}
193+ title : ${{ needs.process-submission.outputs.pr_title }}
194+ body-path : /tmp/pr-body/new-event-${{ github.event.issue.number }}-pr-body.md
195+
196+ post-pr-actions :
197+ needs : [process-submission, create-pr]
198+ if : needs.create-pr.outputs.pull-request-number != ''
199+ runs-on : ubuntu-latest
200+ timeout-minutes : 5
201+ env :
202+ PCD_TEAM_REVIEWERS : ${{ vars.PCD_TEAM_REVIEWERS }}
203+ steps :
131204 - name : Label pull request
132- if : steps.generate.outputs.valid == 'true' && steps.create_pr.outputs.pull-request-number != ''
133205 uses : actions/github-script@v8
134206 with :
135207 script : |
136208 const owner = context.repo.owner;
137209 const repo = context.repo.repo;
138- const issue_number = Number('${{ steps.create_pr .outputs.pull-request-number }}');
210+ const issue_number = Number('${{ needs.create-pr .outputs.pull-request-number }}');
139211 const desiredLabels = [
140212 { name: 'needs review', color: 'fbca04', description: 'Submission is ready for maintainer review' },
141213 { name: 'new event', color: '0e8a16', description: 'New event submission intake' },
@@ -157,13 +229,13 @@ jobs:
157229 labels: desiredLabels.map((label) => label.name),
158230 });
159231 - name : Request team review
160- if : steps.generate.outputs.valid == 'true' && steps.create_pr.outputs.pull-request-number != '' && env.PCD_TEAM_REVIEWERS != ''
232+ if : env.PCD_TEAM_REVIEWERS != ''
161233 uses : actions/github-script@v8
162234 with :
163235 script : |
164236 const owner = context.repo.owner;
165237 const repo = context.repo.repo;
166- const pull_number = Number('${{ steps.create_pr .outputs.pull-request-number }}');
238+ const pull_number = Number('${{ needs.create-pr .outputs.pull-request-number }}');
167239 const team_reviewers = (process.env.PCD_TEAM_REVIEWERS || '')
168240 .split(',')
169241 .map((value) => value.trim())
@@ -178,15 +250,22 @@ jobs:
178250 });
179251 }
180252 - name : Upsert pull request status comment
181- if : steps.generate.outputs.valid == 'true' && steps.create_pr.outputs.pull-request-number != ''
182253 uses : actions/github-script@v8
183254 env :
184- PR_NUMBER : ${{ steps.create_pr.outputs.pull-request-number }}
185- PR_URL : ${{ steps.create_pr.outputs.pull-request-url }}
255+ PR_NUMBER : ${{ needs.create-pr.outputs.pull-request-number }}
256+ PR_URL : ${{ needs.create-pr.outputs.pull-request-url }}
257+ EVENT_NAME : ${{ needs.process-submission.outputs.event_name }}
186258 with :
187259 script : |
188260 const marker = process.env.STATUS_COMMENT_MARKER;
189- const body = `${marker}\nA pull request has been opened for this submission: #${process.env.PR_NUMBER} (${process.env.PR_URL}).`;
261+ const body = [
262+ marker,
263+ 'Thank you for your submission! 🎉',
264+ '',
265+ `**${process.env.EVENT_NAME}** has been successfully parsed and a pull request has been opened for review: #${process.env.PR_NUMBER} (${process.env.PR_URL}).`,
266+ '',
267+ 'Once the PR is merged, your event will be added to the map at https://day.processing.org.',
268+ ].join('\n');
190269 const { data: comments } = await github.rest.issues.listComments({
191270 owner: context.repo.owner,
192271 repo: context.repo.repo,
0 commit comments