Skip to content

Commit 4593ae9

Browse files
nessitafrankwiles
andcommitted
Added automated quality checks for PRs as a GitHub Actions workflow.
This work adds automated PR quality checks as a GitHub Actions workflow to enforce contribution requirements consistently and reduce the manual burden on reviewers for incoming PRs. Thanks to the many reviewers providing meaningful feedback. Co-authored-by: Frank Wiles <frank@revsys.com>
1 parent 82a2465 commit 4593ae9

8 files changed

Lines changed: 1745 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Quality Checks
2+
3+
on:
4+
pull_request_target:
5+
types: [ edited, opened, reopened, ready_for_review, synchronize ]
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
jobs:
18+
pr_quality:
19+
name: Run Quality Checks on a PR
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 5
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v6
25+
with:
26+
persist-credentials: false
27+
# Checking out the default branch (not the PR head) is what makes
28+
# pull_request_target safe: the workflow code always comes from the
29+
# base repo, so a malicious PR cannot alter it.
30+
ref: ${{ github.event.repository.default_branch }}
31+
- name: Set up Python
32+
uses: actions/setup-python@v6
33+
with:
34+
python-version: '3.14'
35+
- name: Run PR quality checks
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
39+
PR_BODY: ${{ github.event.pull_request.body }}
40+
PR_TITLE: ${{ github.event.pull_request.title }}
41+
PR_CREATED_AT: ${{ github.event.pull_request.created_at }}
42+
PR_NUMBER: ${{ github.event.pull_request.number }}
43+
PR_REPO: ${{ github.repository }}
44+
# Only close PRs on the main Django repository; on forks the workflow
45+
# runs in warning-only mode so contributors can test their PRs.
46+
AUTOCLOSE: ${{ github.repository == 'django/django' }}
47+
PYTHONPATH: scripts
48+
run: python scripts/pr_quality/check_pr.py

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,18 @@ jobs:
6060
cache-dependency-path: '**/package.json'
6161
- run: npm install
6262
- run: npm test
63+
64+
scripts-tests:
65+
runs-on: ubuntu-latest
66+
name: Scripts tests
67+
timeout-minutes: 60
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v6
71+
with:
72+
persist-credentials: false
73+
- name: Set up Python
74+
uses: actions/setup-python@v6
75+
with:
76+
python-version: '3.14'
77+
- run: python -m unittest discover -v -s scripts/

scripts/pr_quality/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)