Skip to content

Commit

Permalink
Ignore merge commits on final release branch check (datacommonsorg#4765)
Browse files Browse the repository at this point in the history
The final check looks at the branch after merge, which includes merge
commits added by GitHub when merging PRs. These are the only merge
commits that should be allowed in the final release branch commit
history.
  • Loading branch information
hqpho authored Dec 2, 2024
1 parent fed5115 commit 276b872
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/release-branch-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ jobs:
git fetch dc
MASTER_BRANCH="dc/master"
# Get the list of commits in the source branch that are not in the master branch
MISSING_COMMITS=$(git log --pretty="%H - %s" $MASTER_BRANCH..HEAD --)
# Get the list of commits in the source branch that are not in the master branch.
# Exclude merge commits only if this is the final run in the merge queue.
# This way the only merge commits that end up in the final commit history
# are the ones added by GitHub when merging PRs.
if [[ ${{ github.event_name }} == 'merge_group' ]]; then
MISSING_COMMITS=$(git log --pretty="%H - %s" --no-merges $MASTER_BRANCH..HEAD --)
else
MISSING_COMMITS=$(git log --pretty="%H - %s" $MASTER_BRANCH..HEAD --)
fi
if [[ -n "$MISSING_COMMITS" ]]; then
echo ""
Expand Down

0 comments on commit 276b872

Please sign in to comment.