diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 35c7e3d95b6..0d79568f589 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -56,14 +56,21 @@ jobs: - name: Checkout code repo uses: actions/checkout@v4 with: - ref: ${{ inputs.sha }} - fetch-depth: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).commits }} + fetch-depth: 0 persist-credentials: false + - name: Calculate merge base + id: calculate-merge-base + env: + PR_SHA: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).head.sha }} + BASE_SHA: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.sha }} + run: | + (echo -n "merge-base="; git merge-base "$BASE_SHA" "$PR_SHA") > "$GITHUB_OUTPUT" - name: Get changed files id: changed-files uses: tj-actions/changed-files@v45 with: - base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.sha }} + base_sha: ${{ steps.calculate-merge-base.outputs.merge-base }} + sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).head.sha }} files_yaml: | cpp: - '**'