feat(raycilint): add GitHub Action workflow for PR size checks #8
Workflow file for this run
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: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run prcheck | |
| id: prcheck | |
| continue-on-error: true | |
| 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: always() | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2 | |
| with: | |
| header: prcheck | |
| delete: ${{ steps.prcheck.outcome != 'failure' }} | |
| message: | | |
| ## ⚠️ PR Size Warning | |
| This PR exceeds the size limits defined in `${{ env.CONFIG_PATH }}`. | |
| Please consider breaking it into smaller PRs, or apply the `${{ env.SKIP_LABEL }}` label to bypass. | |
| See the [job status](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for specifics. | |
| - name: Enforce size check | |
| if: steps.prcheck.outcome == 'failure' | |
| env: | |
| PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }} | |
| run: | | |
| if echo ",$PR_LABELS," | grep -q ",$SKIP_LABEL,"; then | |
| echo "Skipping enforcement: $SKIP_LABEL label found" | |
| exit 0 | |
| fi | |
| echo "PR size check failed. Apply the '$SKIP_LABEL' label to bypass." | |
| exit 1 |