Skip to content

Commit c866eca

Browse files
committed
Merge branch 'main' into test_action_20241108
2 parents 65f90ff + 36cde9a commit c866eca

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/CIGuardedTrigger.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,24 @@ jobs:
1414

1515
steps:
1616
- name: Check out code
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1820

1921
- name: Check changed files and conditionally trigger CI
2022
env:
23+
base_repo: ${{ github.event.pull_request.base.repo.clone_url }}
24+
base_branch: ${{ github.event.pull_request.base.ref }}
25+
base_branch_pre: "upstream"
26+
diff_branch: ${{ github.event.pull_request.head.ref }}
2127
REPO_TOKEN: ${{ secrets.WANGZELIN_TOKEN }}
2228
run: |
23-
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
29+
set -x
30+
git fetch "$base_repo" "$base_branch":"$base_branch_pre"/"$base_branch"
31+
git checkout "$base_branch_pre"/"$base_branch"
32+
git checkout "$diff_branch"
33+
34+
FILES=$(git --no-pager diff --name-only --diff-filter=ACMRT "$base_branch_pre"/"$base_branch"..."$diff_branch")
2435
echo "Changed files:"
2536
echo "$FILES"
2637

0 commit comments

Comments
 (0)