Skip to content

Commit

Permalink
ci: updated fixup check to only run for up to date PR
Browse files Browse the repository at this point in the history
  • Loading branch information
frazarshad committed Sep 25, 2024
1 parent 4a1e4c3 commit b496ab9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/mergify-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,17 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if PR is up to date with master
id: is_based_on_main
run: |
result=$(git merge-base --is-ancestor $BASE_SHA $HEAD_SHA && echo true || echo false)
if [[ "$result" == "false" ]]; then
echo "PR is not up to date with master branch, skipping fixup commit check"
fi
echo "BRANCH_UP_TO_DATE=$result" >> $GITHUB_ENV
- name: Check for fixup commits
id: fixup-commits
if: ${{ env.BRANCH_UP_TO_DATE == 'true' }}
run: |
if [[ $(git rev-list "$BASE_SHA".."$HEAD_SHA" --grep="^\(fixup\|amend\|squash\)! " | wc -l) -eq 0 ]]; then
echo "No fixup/amend/squash commits found in commit history"
Expand Down

0 comments on commit b496ab9

Please sign in to comment.