Update Resend template with optional CAA record #1366
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: PR Description Check | |
| on: | |
| pull_request_target: | |
| branches: | |
| - master | |
| types: [opened, edited, synchronize, reopened] | |
| merge_group: | |
| branches: | |
| - master | |
| jobs: | |
| check-description: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| # skip on merge queue, because PR context not available to make any checks | |
| if: github.event_name != 'merge_group' | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Get changed template JSON files | |
| id: changed-templates | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: '*.json' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Run PR description check | |
| id: pr-check | |
| env: | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| TEMPLATE_FILES: ${{ steps.changed-templates.outputs.all_changed_files }} | |
| LABELS_ADD_FILE: /tmp/pr_labels_add.txt | |
| LABELS_REMOVE_FILE: /tmp/pr_labels_remove.txt | |
| REQUIRED_PAYLOAD_KEYS: ${{ secrets.REQUIRED_PAYLOAD_KEYS }} | |
| DC_APPLY_STATE_HMAC_KEY: ${{ secrets.DC_APPLY_STATE_HMAC_KEY }} | |
| run: | | |
| set +e | |
| python .github/scripts/check_pr_description.py 2>&1 | tee /tmp/pr_check_output.txt | |
| echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "check_output<<EOF" | |
| cat /tmp/pr_check_output.txt | |
| echo "EOF" | |
| } >> "$GITHUB_ENV" | |
| - name: Add labels | |
| if: always() | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| labels_file="/tmp/pr_labels_add.txt" | |
| if [ ! -f "$labels_file" ] || [ ! -s "$labels_file" ]; then | |
| echo "No labels to add." | |
| exit 0 | |
| fi | |
| pr_number="${{ github.event.pull_request.number }}" | |
| repo="${{ github.repository }}" | |
| while IFS= read -r label; do | |
| [ -z "$label" ] && continue | |
| echo "Adding label: $label" | |
| gh pr edit "$pr_number" --repo "$repo" --add-label "$label" | |
| done < "$labels_file" | |
| - name: Remove labels | |
| if: always() | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| labels_file="/tmp/pr_labels_remove.txt" | |
| if [ ! -f "$labels_file" ] || [ ! -s "$labels_file" ]; then | |
| echo "No labels to remove." | |
| exit 0 | |
| fi | |
| pr_number="${{ github.event.pull_request.number }}" | |
| repo="${{ github.repository }}" | |
| while IFS= read -r label; do | |
| [ -z "$label" ] && continue | |
| echo "Removing label: $label" | |
| gh pr edit "$pr_number" --repo "$repo" --remove-label "$label" 2>/dev/null || true | |
| done < "$labels_file" | |
| - name: Comment PR - delete ok comment on failure | |
| if: steps.pr-check.outputs.exit_code != '0' | |
| continue-on-error: true | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| comment_tag: pr_description_check_ok | |
| mode: delete | |
| - name: Comment PR - check failed | |
| if: steps.pr-check.outputs.exit_code != '0' | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| message: | | |
| ## PR Description Check Failed | |
| The PR description is missing required elements. Please update it according to the [PR template](${{ github.server_url }}/${{ github.repository }}/blob/master/.github/pull_request_template.md?plain=1). | |
| <details><summary>Details</summary> | |
| ``` | |
| ${{ env.check_output }} | |
| ``` | |
| </details> | |
| comment_tag: pr_description_check | |
| mode: recreate | |
| - name: Comment PR - delete fail comment on success | |
| if: steps.pr-check.outputs.exit_code == '0' | |
| continue-on-error: true | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| comment_tag: pr_description_check | |
| mode: delete | |
| - name: Comment PR - check passed | |
| if: steps.pr-check.outputs.exit_code == '0' | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| message: | | |
| ## PR Description Check Passed | |
| All required sections are filled in correctly. | |
| <details><summary>Details</summary> | |
| ``` | |
| ${{ env.check_output }} | |
| ``` | |
| </details> | |
| comment_tag: pr_description_check_ok | |
| - name: Fail job if check failed | |
| if: steps.pr-check.outputs.exit_code != '0' | |
| run: exit 1 |