Skip to content

Commit d926d56

Browse files
committed
Merge branch 'epic/v3' of github.com:DesignSafe-CI/DS-User-Guide into epic/v3
2 parents d552dd2 + 80f258f commit d926d56

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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"

0 commit comments

Comments
 (0)