Skip to content

Commit a898e07

Browse files
[Github] Force changed files step to use GH API for code formatting
This patch forces the code formatting action to use the GH API to get changed files rather than looking through the git history. This should save about 10m per job (most of the current runtime) due to the avoidance of expensive partial clone operations.
1 parent 1d4601a commit a898e07

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ jobs:
77
code_formatter:
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Fetch LLVM sources
11-
uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 2
14-
10+
# Get changed files before we do a checkout to force the action to use
11+
# the GH API to look for changed files and avoid an expensive partial
12+
# fetch operation.
1513
- name: Get changed files
1614
id: changed-files
1715
uses: tj-actions/changed-files@v39
1816
with:
1917
separator: ","
20-
fetch_depth: 100 # Fetches only the last 10 commits
18+
19+
- name: Fetch LLVM sources
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: ${{ github.event.pull_request.commits }}
23+
ref: ${{ github.event.pull_request.head.ref }}
2124

2225
- name: "Listed files"
2326
run: |

0 commit comments

Comments
 (0)