Skip to content

Commit

Permalink
ci: workflows: check-commits: fix CI_BASE_BRANCH for merge_groups
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Nov 8, 2023
1 parent cd97805 commit 34d407f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/check-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ jobs:
matrix:
check: [commit-msg, pr_check]
steps:
- name: set CI_BASE_BRANCH
run: |
if [ -n "${{ github.base_ref }}" ]; then
echo "CI_BASE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
elif [ -n "${{ github.event.merge_group.base_ref }}" ]; then
echo "CI_BASE_BRANCH=${{ github.event.merge_group.base_ref }}" | sed s.=refs/heads/.=. >> $GITHUB_ENV
fi
- uses: actions/checkout@main
with:
# Use the SHA of the PR branch as-is, not the PR branch merged
Expand All @@ -22,10 +29,10 @@ jobs:
fetch-depth: 0
- name: Fetch base branch
run:
git fetch origin '${{ github.base_ref }}:${{ github.base_ref }}'
git fetch origin "${CI_BASE_BRANCH}:${CI_BASE_BRANCH}"
- name: Run checks
run: |
./dist/tools/${{ matrix.check }}/check.sh "${{ github.base_ref }}"
./dist/tools/${{ matrix.check }}/check.sh "${CI_BASE_BRANCH}"
check-commits-success:
needs: check-commits
if: github.event_name != 'merge_group'
Expand Down

0 comments on commit 34d407f

Please sign in to comment.