Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): lint for bang commits (fixup, squash, drop, edit) #135

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,28 @@ jobs:
with:
name: django-logs
path: app/debug.log
lint-commits:
runs-on: ubuntu-latest
if: github.event.ref != 'refs/heads/main'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get all commits on current main
run: git fetch origin main
- name: Log all commits we will analyse
run: git log --pretty=format:%s origin/main..HEAD

# - We use -v here, which inverts the match, because we want to output an exit status of 1 when a match _is_
# found (usually 0 is for a match)
# - We use a -z here, which makes \0 be the line separator, because if feeding multiline text into grep, it will
# exit with a status of 0 regardless of whether there is a match (so, -z makes it treat the input as one line)
- name: Disallow fixup commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv 'fixup!'
- name: Disallow squash commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv 'squash!'
- name: Disallow edit commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv 'edit!'
- name: Disallow drop commits
run: git log --pretty=format:%s origin/main..HEAD | grep -zv 'drop!'