Add BOG-A-THON 2 event (#8277) #2
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: Correctness Checks | |
| on: | |
| pull_request: | |
| # We avoid running the push event on PR branches so that | |
| # they are instead run through pull_request and we get the merge base | |
| # for use below. | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| Run-Markdown-Checks: | |
| name: Run Markdown Checks | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Install Python dependencies | |
| uses: py-actions/py-dependency-install@9c419aa98bfb42280bdae2b0a736befd9b01e3b1 # v4 | |
| with: | |
| path: "tools/requirements.txt" | |
| update-pip: "false" | |
| update-setuptools: "false" | |
| update-wheel: "false" | |
| - name: Compute PR diff base | |
| if: ${{ github.event_name == 'pull_request' }} | |
| id: base | |
| shell: bash | |
| run: | | |
| BASE="$(git merge-base \ | |
| "${{ github.event.pull_request.base.sha }}" \ | |
| "${{ github.event.pull_request.head.sha }}")" | |
| echo "base=$BASE" >> "$GITHUB_OUTPUT" | |
| - name: inspect_links for main | |
| if: ${{ github.event_name == 'push' }} | |
| run: python3 tools/inspect_links.py | |
| - name: inspect_links for pull request | |
| if: ${{ github.event_name == 'pull_request' }} | |
| id: inspect_links_pr | |
| shell: bash | |
| env: | |
| CHECK_OUTPUT_FILE: ${{ runner.temp }}/inspect-links-pr.txt | |
| run: | | |
| set +e | |
| python3 tools/inspect_links.py \ | |
| --since "${{ steps.base.outputs.base }}" \ | |
| --show-warnings > "$CHECK_OUTPUT_FILE" | |
| status="$?" | |
| cat "$CHECK_OUTPUT_FILE" | |
| if [[ "$status" -eq 0 ]]; then | |
| echo "failed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "failed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| exit 0 | |
| - name: inspect_markdown for main | |
| if: ${{ github.event_name == 'push' }} | |
| run: python3 tools/inspect_markdown.py --num-recent 5 | |
| - name: inspect_markdown for pull request | |
| if: ${{ github.event_name == 'pull_request' }} | |
| id: inspect_markdown_pr | |
| shell: bash | |
| env: | |
| CHECK_OUTPUT_FILE: ${{ runner.temp }}/inspect-markdown-pr.txt | |
| run: | | |
| set +e | |
| python3 tools/inspect_markdown.py --num-recent 5 > "$CHECK_OUTPUT_FILE" | |
| status="$?" | |
| cat "$CHECK_OUTPUT_FILE" | |
| if [[ "$status" -eq 0 ]]; then | |
| echo "failed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "failed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| exit 0 | |
| # Upload the check output so the workflow_run workflow can fetch it later. | |
| # That follow-up workflow has permission to write PR comments, unlike this | |
| # pull_request workflow which runs on possibly-untrusted forks. | |
| - name: Prepare PR check output metadata | |
| if: ${{ github.event_name == 'pull_request' }} | |
| shell: bash | |
| run: echo "${{ github.event.pull_request.number }}" > "${{ runner.temp }}/pr-number.txt" | |
| - name: Upload PR check output | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr-check-output | |
| path: | | |
| ${{ runner.temp }}/pr-number.txt | |
| ${{ runner.temp }}/inspect-links-pr.txt | |
| ${{ runner.temp }}/inspect-markdown-pr.txt | |
| if-no-files-found: ignore | |
| - name: Fail PR check on errors | |
| if: ${{ github.event_name == 'pull_request' && (steps.inspect_links_pr.outputs.failed == 'true' || steps.inspect_markdown_pr.outputs.failed == 'true') }} | |
| run: exit 1 |