name: PR hygiene
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Collect PR labels
id: labels
run: |
python - <<'PY'
import json, os
event = json.load(open(os.environ['GITHUB_EVENT_PATH'], 'r'))
labels = [l['name'] for l in event.get('pull_request', {}).get('labels', [])]
out = os.environ.get("GITHUB_OUTPUT")
if out:
with open(out, "a", encoding="utf-8") as f:
f.write("labels=" + ",".join(labels) + "\\n")
else:
print('labels=' + ','.join(labels))
PY
- name: Enforce changelog when implementation changes
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_SHA: ${{ github.sha }}
PR_LABELS: ${{ steps.labels.outputs.labels }}
run: |
python scripts/check_pr_hygiene.py