-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow for checking unresolved auto-squash commits
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Unresolved auto-squash commits" | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-commits: | ||
name: "Unresolved auto-squash commits" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# OPTIMIZE: For a problem around performance, use single-branch & just for ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF} | ||
fetch-depth: 0 | ||
- name: "Unresolved auto-squash commits exist" | ||
run: |- | ||
BASE_REF=${GITHUB_BASE_REF:-main} | ||
GIT_LOG="$(git log --oneline ${BASE_REF}.. | grep -E '(fixup!|squash!)' || true)" | ||
echo "${GIT_LOG}" | ||
if [[ -n ${GIT_LOG} ]]; then | ||
echo 'this pr branch has unresolved auto-squash commit(s)' 1>&2 | ||
exit 1 | ||
fi | ||
echo 'this pr branch has no unresolved auto-squash commits' |