Skip to content

Commit 9b381c6

Browse files
[Github] Fetch number of commits in PR for docs action (#69763)
This patches changes the docs action to run a fetch with a depth of the number of commits in the PR (1 if we're just running against a push event) which significantly increases the speed of the changed files event. The changed files event goes from taking ~30m to ~3s without any noticeable increase in fetch time.
1 parent 14bc11a commit 9b381c6

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

.github/workflows/docs.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,28 @@ jobs:
2525
name: "Test documentation build"
2626
runs-on: ubuntu-latest
2727
steps:
28-
- name: Fetch LLVM sources
28+
# Fetch all the commits in a pull request so that the
29+
# docs-changed-subprojects step won't pull them in itself in an extremely
30+
# slow manner.
31+
- name: Fetch LLVM sources (PR)
32+
if: ${{ github.event_name == 'pull_request' }}
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: ${{ github.event.pull_request.commits }}
36+
- name: Fetch LLVM sources (push)
37+
if: ${{ github.event_name == 'push' }}
2938
uses: actions/checkout@v4
3039
with:
3140
fetch-depth: 1
41+
- name: Get subprojects that have doc changes
42+
id: docs-changed-subprojects
43+
uses: tj-actions/changed-files@v39
44+
with:
45+
files_yaml: |
46+
llvm:
47+
- 'llvm/docs/**'
48+
clang:
49+
- 'clang/docs/**'
3250
- name: Setup Python env
3351
uses: actions/setup-python@v4
3452
with:
@@ -41,15 +59,6 @@ jobs:
4159
run: |
4260
sudo apt-get update
4361
sudo apt-get install -y cmake ninja-build
44-
- name: Get subprojects that have doc changes
45-
id: docs-changed-subprojects
46-
uses: tj-actions/changed-files@v39
47-
with:
48-
files_yaml: |
49-
llvm:
50-
- 'llvm/docs/**'
51-
clang:
52-
- 'clang/docs/**'
5362
- name: Build LLVM docs
5463
if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true'
5564
run: |

0 commit comments

Comments
 (0)