Skip to content

feat(raycilint): add GitHub Action workflow for PR size checks #16

feat(raycilint): add GitHub Action workflow for PR size checks

feat(raycilint): add GitHub Action workflow for PR size checks #16

Workflow file for this run

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 }}`.
${{ 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: 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