video: events & indexing #26
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: Validate Registry Intake | |
| on: | |
| issues: | |
| types: [opened, edited, reopened] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| validate: | |
| if: contains(github.event.issue.labels.*.name, 'registry-intake') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clear previous state labels | |
| # Kind subtype labels (registry-intake:publish/register/deploy/admin) are | |
| # applied by the form template itself and are NOT cleared here — they | |
| # persist for the lifetime of the issue. | |
| uses: issue-ops/labeler@v4 | |
| with: | |
| action: remove | |
| issue_number: ${{ github.event.issue.number }} | |
| labels: | | |
| registry-intake:in-review | |
| registry-intake:accepted | |
| registry-intake:rejected | |
| registry-intake:submitted | |
| registry-intake:submission-failed | |
| issueops:validation-error | |
| - name: Resolve form kind and template | |
| id: kind | |
| env: | |
| LABELS_JSON: ${{ toJSON(github.event.issue.labels) }} | |
| run: | | |
| set -euo pipefail | |
| KIND=$(jq -r ' | |
| .[].name | |
| | select(startswith("registry-intake:")) | |
| | sub("^registry-intake:"; "") | |
| | select(. == "publish" or . == "register" or . == "deploy" or . == "admin") | |
| ' <<<"$LABELS_JSON" | head -n 1) | |
| if [ -z "${KIND:-}" ]; then | |
| echo "::error::Issue has the parent `registry-intake` label but no kind subtype (publish/register/deploy/admin). The form template should set both." | |
| exit 1 | |
| fi | |
| case "$KIND" in | |
| publish) TEMPLATE=registry-publish.yml ;; | |
| register) TEMPLATE=registry-register.yml ;; | |
| deploy) TEMPLATE=registry-deploy.yml ;; | |
| admin) TEMPLATE=registry-admin.yml ;; | |
| esac | |
| echo "kind=$KIND" >> "$GITHUB_OUTPUT" | |
| echo "template=$TEMPLATE" >> "$GITHUB_OUTPUT" | |
| - name: Checkout repo (for validator scripts and form templates) | |
| uses: actions/checkout@v6 | |
| - name: Parse intake form | |
| id: parse | |
| uses: issue-ops/parser@v5 | |
| with: | |
| body: ${{ github.event.issue.body }} | |
| issue-form-template: ${{ steps.kind.outputs.template }} | |
| - name: Validate intake form | |
| id: validate | |
| uses: issue-ops/validator@v4 | |
| with: | |
| issue-form-template: ${{ steps.kind.outputs.template }} | |
| parsed-issue-body: ${{ steps.parse.outputs.json }} | |
| add-comment: false | |
| - name: Success → in-review | |
| if: steps.validate.outputs.result == 'success' | |
| uses: issue-ops/labeler@v4 | |
| with: | |
| action: add | |
| create: true | |
| issue_number: ${{ github.event.issue.number }} | |
| labels: | | |
| registry-intake:in-review | |
| - name: Success → comment with quorum hint | |
| if: steps.validate.outputs.result == 'success' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh issue comment "${{ github.event.issue.number }}" -R "${{ github.repository }}" --body \ | |
| ":zap: Validation passed — this intake is now \`registry-intake:in-review\`. | |
| **Pilots:** react with :+1: or :-1: on this issue. When you believe the quorum has been reached, comment \`.quorum-check\` to tally votes and either accept or reject. | |
| The quorum policy for kind=\`${{ steps.kind.outputs.kind }}\` is in [\`.github/registry-quorum.yml\`](https://github.com/${{ github.repository }}/blob/main/.github/registry-quorum.yml)." | |
| - name: Failure → validation-error label | |
| if: steps.validate.outputs.result != 'success' | |
| uses: issue-ops/labeler@v4 | |
| with: | |
| action: add | |
| create: true | |
| issue_number: ${{ github.event.issue.number }} | |
| labels: | | |
| issueops:validation-error | |
| - name: Failure → comment with rendered errors | |
| if: steps.validate.outputs.result != 'success' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COMMENT_ERRORS: ${{ steps.validate.outputs.errors }} | |
| run: | | |
| python3 .github/scripts/render_validation_failure.py | \ | |
| gh issue comment "${{ github.event.issue.number }}" -R "${{ github.repository }}" --body-file - | |
| - name: Failure → fail the job | |
| if: steps.validate.outputs.result != 'success' | |
| run: | | |
| echo "::error::Form validation failed. See the issue comment for details." | |
| exit 1 |