diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2c5de08a7..b1f9698d4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -135,16 +135,16 @@ jobs: GITHUB_TOKEN: ${{ github.token }} EXCLUDE_COMMIT: ${{ github.event.after }} run: python3 -u ci_changes_per_commit.py + - name: Set head sha + if: github.event_name == 'pull_request' + run: echo "HEAD_SHA=$(git show -s --format=%s $GITHUB_SHA | grep -o -P "(?<=Merge ).*(?= into)")" >> $GITHUB_ENV - name: Set base sha if: github.event_name == 'pull_request' run: | - DEEPEN=$((DEPTH - $(git rev-list HEAD --count))) && if((DEEPEN > 0)); then git fetch --no-tags --recurse-submodules=no --deepen=$DEEPEN; fi - echo "BASE_SHA=$(git rev-list $GITHUB_SHA --skip=$((DEPTH + 1)) --max-count=1)" >> $GITHUB_ENV + git fetch --no-tags --no-recurse-submodules --depth=$((DEPTH + 1)) origin $HEAD_SHA + echo "BASE_SHA=$(git rev-list $HEAD_SHA --skip=$DEPTH --max-count=1)" >> $GITHUB_ENV env: DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }} - - name: Set head sha - if: github.event_name == 'pull_request' - run: echo "HEAD_SHA=$(git rev-list $GITHUB_SHA --skip=1 --max-count=1)" >> $GITHUB_ENV - name: Get changes id: get-changes if: github.event_name == 'pull_request'