File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check Commit Author
2+ on : push
3+ jobs :
4+ author-check :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - name : Checkout
8+ uses : actions/checkout@v4
9+ - name : Verify commit authors
10+ run : |
11+ # List of banned authors and emails (case-insensitive). You can add more.
12+ banned_authors=("linus torvalds" "satoshi nakamoto" "elon musk")
13+ 14+
15+ # Get all authors and emails in the push range
16+ authors=$(git log --format='%an' ${{ github.event.before }}..${{ github.sha }})
17+ emails=$(git log --format='%ae' ${{ github.event.before }}..${{ github.sha }})
18+
19+ # Check names
20+ for banned in "${banned_authors[@]}"; do
21+ if echo "$authors" | grep -i "$banned"; then
22+ echo "Blocked: Commit attributed to banned author '$banned'."
23+ exit 1
24+ fi
25+ done
26+
27+ # Check emails
28+ for email in "${banned_emails[@]}"; do
29+ if echo "$emails" | grep -i "$email"; then
30+ echo "Blocked: Commit attributed to banned email '$email'."
31+ exit 1
32+ fi
33+ done
34+
35+ echo "Author check passed. No banned commit authors found."
You can’t perform that action at this time.
0 commit comments