File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Validate `requirements.txt`
2+
3+ on :
4+ pull_request :
5+ push :
6+
7+ jobs :
8+ check-requirements :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
14+ with :
15+ fetch-depth : 2
16+
17+ - name : Check if requirements.txt was modified unexpectedly
18+ run : |
19+ # Get author of last commit
20+ AUTHOR=$(git log -1 --pretty=format:'%an')
21+
22+ # Check if requirements.txt was modified in last commit
23+ if git diff --name-only HEAD~1 HEAD | grep -q "^requirements.txt$"; then
24+ if [ "$AUTHOR" != "github-actions[bot]" ]; then
25+ echo "❌ ERROR: You may NOT edit `requirements.txt`"
26+ echo "To pin dependencies, use `poetry add <package-name>`."
27+ echo "Please remove your changes to requirements.txt, so the robot can maintain it."
28+ exit 1
29+ fi
30+ fi
31+
32+ echo "✅ SUCCESS: `requirements.txt` not modified unexpectedly"
You can’t perform that action at this time.
0 commit comments