Skip to content

Commit 3a4bffd

Browse files
committed
use correct commits for diff
1 parent ec74be7 commit 3a4bffd

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ jobs:
6767
run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
6868
- name: Set base sha (pull)
6969
if: github.event_name == 'pull_request'
70-
run: |
71-
git fetch --no-tags --no-recurse-submodules --depth=$((DEPTH + 1)) origin $HEAD_SHA
72-
echo "BASE_SHA=$(git rev-list $HEAD_SHA --skip=$DEPTH --max-count=1)" >> $GITHUB_ENV
70+
run: git cat-file -e $SHA && echo "BASE_SHA=$SHA" >> $GITHUB_ENV || true
7371
env:
74-
DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }}
72+
SHA: ${{ steps.get-last-commit-with-checks.outputs.commit_sha || github.event.pull_request.base.sha }}
7573
- name: Set head sha (push)
7674
if: github.event_name == 'push'
7775
run: echo "HEAD_SHA=${{ github.event.after }}" >> $GITHUB_ENV

tools/ci_set_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def git_diff(pattern: str):
8989
print("Using files list by computing diff")
9090
changed_files = git_diff("$BASE_SHA...$HEAD_SHA")
9191
if os.environ.get("GITHUB_EVENT_NAME") == "pull_request":
92-
changed_files.intersection_update(git_diff("$HEAD_SHA~...$HEAD_SHA"))
92+
changed_files.intersection_update(git_diff("$GITHUB_SHA~...$GITHUB_SHA"))
9393
else:
9494
print("Using files list in CHANGED_FILES")
9595
changed_files = set(json.loads(os.environ.get("CHANGED_FILES") or "[]"))

0 commit comments

Comments
 (0)