New Event: PDC @ Denver 2025 #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: New Event Intake | |
| on: | |
| issues: | |
| types: [opened, edited, reopened, labeled] | |
| concurrency: | |
| group: new-event-intake-${{ github.event.issue.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| env: | |
| STATUS_COMMENT_MARKER: <!-- new-event-intake-status --> | |
| jobs: | |
| process-submission: | |
| if: contains(github.event.issue.labels.*.name, 'new event') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| env: | |
| PCD_TEAM_ASSIGNEES: ${{ vars.PCD_TEAM_ASSIGNEES }} | |
| PCD_TEAM_REVIEWERS: ${{ vars.PCD_TEAM_REVIEWERS }} | |
| outputs: | |
| valid: ${{ steps.generate.outputs.valid }} | |
| branch: ${{ steps.generate.outputs.branch }} | |
| commit_message: ${{ steps.generate.outputs.commit_message }} | |
| pr_title: ${{ steps.generate.outputs.pr_title }} | |
| pr_body_path: ${{ steps.generate.outputs.pr_body_path }} | |
| validation_comment_path: ${{ steps.generate.outputs.validation_comment_path }} | |
| event_name: ${{ steps.generate.outputs.event_name }} | |
| steps: | |
| - name: Label and assign intake issue | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const issue_number = context.issue.number; | |
| const desiredLabels = [ | |
| { name: 'needs review', color: 'fbca04', description: 'Submission is ready for maintainer review' }, | |
| { name: 'new event', color: '0e8a16', description: 'New event submission intake' }, | |
| ]; | |
| for (const label of desiredLabels) { | |
| try { | |
| await github.rest.issues.getLabel({ owner, repo, name: label.name }); | |
| } catch (error) { | |
| if (error.status !== 404) throw error; | |
| await github.rest.issues.createLabel({ owner, repo, ...label }); | |
| } | |
| } | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number, | |
| labels: desiredLabels.map((label) => label.name), | |
| }); | |
| const assignees = (process.env.PCD_TEAM_ASSIGNEES || '') | |
| .split(',') | |
| .map((value) => value.trim()) | |
| .filter(Boolean); | |
| if (assignees.length) { | |
| await github.rest.issues.addAssignees({ | |
| owner, | |
| repo, | |
| issue_number, | |
| assignees, | |
| }); | |
| } | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.repository.default_branch }} | |
| persist-credentials: false | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Generate event files from issue | |
| id: generate | |
| run: node .github/scripts/process-new-event-issue.mjs | |
| - name: Log generate outputs | |
| if: always() | |
| run: | | |
| echo "valid=${{ steps.generate.outputs.valid }}" | |
| echo "branch=${{ steps.generate.outputs.branch }}" | |
| echo "event_name=${{ steps.generate.outputs.event_name }}" | |
| echo "validation_comment_path=${{ steps.generate.outputs.validation_comment_path }}" | |
| echo "pr_body_path=${{ steps.generate.outputs.pr_body_path }}" | |
| - name: Upload event files artifact | |
| if: steps.generate.outputs.valid == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: event-files-${{ github.event.issue.number }} | |
| path: pcd-website/src/content/events/ | |
| retention-days: 1 | |
| - name: Upload PR body artifact | |
| if: steps.generate.outputs.valid == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr-body-${{ github.event.issue.number }} | |
| path: ${{ steps.generate.outputs.pr_body_path }} | |
| retention-days: 1 | |
| - name: Upload validation comment artifact | |
| if: steps.generate.outputs.valid == 'false' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: validation-comment-${{ github.event.issue.number }} | |
| path: ${{ steps.generate.outputs.validation_comment_path }} | |
| retention-days: 1 | |
| handle-validation-failure: | |
| needs: process-submission | |
| if: needs.process-submission.outputs.valid == 'false' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Download validation comment artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: validation-comment-${{ github.event.issue.number }} | |
| path: /tmp/validation-comment | |
| - name: Upsert validation status comment | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const marker = process.env.STATUS_COMMENT_MARKER; | |
| const commentPath = `/tmp/validation-comment/new-event-${context.issue.number}-validation.md`; | |
| const body = `${marker}\n${fs.readFileSync(commentPath, 'utf8')}`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find((comment) => | |
| comment.user?.type === 'Bot' && | |
| comment.body?.includes(marker) | |
| ); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } | |
| create-pr: | |
| needs: process-submission | |
| if: needs.process-submission.outputs.valid == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| outputs: | |
| pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} | |
| pull-request-url: ${{ steps.create_pr.outputs.pull-request-url }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.repository.default_branch }} | |
| - name: Download event files artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: event-files-${{ github.event.issue.number }} | |
| path: pcd-website/src/content/events/ | |
| - name: Download PR body artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pr-body-${{ github.event.issue.number }} | |
| path: /tmp/pr-body | |
| - name: Create pull request | |
| id: create_pr | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ needs.process-submission.outputs.branch }} | |
| delete-branch: true | |
| add-paths: | | |
| pcd-website/src/content/events/** | |
| commit-message: ${{ needs.process-submission.outputs.commit_message }} | |
| title: ${{ needs.process-submission.outputs.pr_title }} | |
| body-path: /tmp/pr-body/new-event-${{ github.event.issue.number }}-pr-body.md | |
| post-pr-actions: | |
| needs: [process-submission, create-pr] | |
| if: needs.create-pr.outputs.pull-request-number != '' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| PCD_TEAM_REVIEWERS: ${{ vars.PCD_TEAM_REVIEWERS }} | |
| steps: | |
| - name: Label pull request | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const issue_number = Number('${{ needs.create-pr.outputs.pull-request-number }}'); | |
| const desiredLabels = [ | |
| { name: 'needs review', color: 'fbca04', description: 'Submission is ready for maintainer review' }, | |
| { name: 'new event', color: '0e8a16', description: 'New event submission intake' }, | |
| ]; | |
| for (const label of desiredLabels) { | |
| try { | |
| await github.rest.issues.getLabel({ owner, repo, name: label.name }); | |
| } catch (error) { | |
| if (error.status !== 404) throw error; | |
| await github.rest.issues.createLabel({ owner, repo, ...label }); | |
| } | |
| } | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number, | |
| labels: desiredLabels.map((label) => label.name), | |
| }); | |
| - name: Request team review | |
| if: env.PCD_TEAM_REVIEWERS != '' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const pull_number = Number('${{ needs.create-pr.outputs.pull-request-number }}'); | |
| const team_reviewers = (process.env.PCD_TEAM_REVIEWERS || '') | |
| .split(',') | |
| .map((value) => value.trim()) | |
| .filter(Boolean); | |
| if (team_reviewers.length) { | |
| await github.rest.pulls.requestReviewers({ | |
| owner, | |
| repo, | |
| pull_number, | |
| team_reviewers, | |
| }); | |
| } | |
| - name: Upsert pull request status comment | |
| uses: actions/github-script@v8 | |
| env: | |
| PR_NUMBER: ${{ needs.create-pr.outputs.pull-request-number }} | |
| PR_URL: ${{ needs.create-pr.outputs.pull-request-url }} | |
| EVENT_NAME: ${{ needs.process-submission.outputs.event_name }} | |
| with: | |
| script: | | |
| const marker = process.env.STATUS_COMMENT_MARKER; | |
| const body = [ | |
| marker, | |
| 'Thank you for your submission! 🎉', | |
| '', | |
| `**${process.env.EVENT_NAME}** has been successfully parsed and a pull request has been opened for review: #${process.env.PR_NUMBER}).`, | |
| '', | |
| 'Once the PR is merged, your event will be added to the map at https://day.processing.org.', | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find((comment) => | |
| comment.user?.type === 'Bot' && | |
| comment.body?.includes(marker) | |
| ); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |