Skip to content

Commit 099ce25

Browse files
[Github] Fetch before files changed action on push in docs action
My previous commit 397f1ce switched up the docs github action to use the GH API for pull requests. However, this breaks the action when pushing to a branch as the Github API can't provide diffs for commits. This patch fixes that by creating a local checkout beforehand on push events for determining the changed files.
1 parent 368a398 commit 099ce25

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/docs.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ jobs:
3333
name: "Test documentation build"
3434
runs-on: ubuntu-latest
3535
steps:
36+
# Don't fetch before checking for file changes to force the file changes
37+
# action to use the Github API in pull requests. If it's a push to a
38+
# branch we can't use the Github API to get the diff, so we need to have
39+
# a local checkout beforehand.
40+
- name: Fetch LLVM sources (Push)
41+
if: ${{ github.event_name == 'push' }}
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 1
3645
- name: Get subprojects that have doc changes
3746
id: docs-changed-subprojects
3847
uses: tj-actions/changed-files@v39
@@ -50,7 +59,8 @@ jobs:
5059
- 'libunwind/docs/**'
5160
libcxx:
5261
- 'libcxx/docs/**'
53-
- name: Fetch LLVM sources
62+
- name: Fetch LLVM sources (PR)
63+
if: ${{ github.event_name == 'pull_request' }}
5464
uses: actions/checkout@v4
5565
with:
5666
fetch-depth: 1

0 commit comments

Comments
 (0)