diff --git a/.github/workflows/check-commits.yml b/.github/workflows/check-commits.yml index c4d15bacf70a6..5423e0580c921 100644 --- a/.github/workflows/check-commits.yml +++ b/.github/workflows/check-commits.yml @@ -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 @@ -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'