dnm: triggering file length audit #41
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 Check | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| permissions: | |
| pull-requests: write | |
| env: | |
| CONFIG_PATH: ".buildkite/prcheck-policy.yaml" | |
| SKIP_LABEL: "skip-prcheck" | |
| jobs: | |
| check: | |
| name: PR size check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check for skip label | |
| id: check | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, env.SKIP_LABEL) }} | |
| run: echo "run=true" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v4 | |
| if: steps.check.outputs.run | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - uses: actions/setup-go@v5 | |
| if: steps.check.outputs.run | |
| with: | |
| go-version-file: go.mod | |
| - name: Run prcheck | |
| id: prcheck | |
| if: steps.check.outputs.run | |
| env: | |
| BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| run: >- | |
| go run ./prcheck/prcheck | |
| -config "$CONFIG_PATH" | |
| -base-ref "$BASE_REF" | |
| -head-ref "$HEAD_REF" | |
| - name: Update size warning comment | |
| if: failure() | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 | |
| with: | |
| header: prcheck | |
| message: | | |
| ## ⚠️ PR Size Warning | |
| This PR exceeds the size limits defined in `${{ env.CONFIG_PATH }}`. | |
| ${{ steps.prcheck.outputs.additions && format('- additions: `{0}`', steps.prcheck.outputs.additions) || '' }} | |
| ${{ steps.prcheck.outputs.deletions && format('- deletions: `{0}`', steps.prcheck.outputs.deletions) || '' }} | |
| Break this into smaller PRs, or apply the `${{ env.SKIP_LABEL }}` label to bypass. | |
| - name: Delete size warning comment | |
| if: success() || !steps.check.outputs.run | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 | |
| with: | |
| header: prcheck | |
| delete: true |