Skip to content

Commit 3844d2d

Browse files
ambvclaude
andcommitted
Add CI check that requirements.in and requirements.txt change together
Prevents merging PRs where someone edits requirements.in but forgets to regenerate the lockfile with pip-compile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 85d32e5 commit 3844d2d

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
name: Dummy-CI
1+
name: CI
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
47

58
jobs:
6-
build:
9+
check-lockfile:
10+
name: Check backend lockfile is up to date
11+
if: github.event_name == 'pull_request'
712
runs-on: ubuntu-latest
813
steps:
9-
- uses: actions/checkout@v1
10-
- name: Pass
11-
run: echo Success!
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Ensure requirements.txt is updated when requirements.in changes
18+
run: |
19+
BASE=${{ github.event.pull_request.base.sha }}
20+
HEAD=${{ github.event.pull_request.head.sha }}
21+
CHANGED=$(git diff --name-only "$BASE" "$HEAD")
22+
if echo "$CHANGED" | grep -q 'backend/requirements\.in'; then
23+
if ! echo "$CHANGED" | grep -q 'backend/requirements\.txt'; then
24+
echo "::error::backend/requirements.in was modified but backend/requirements.txt was not. Please run pip-compile to regenerate the lockfile."
25+
exit 1
26+
fi
27+
fi

0 commit comments

Comments
 (0)