[llvm] [Github] Use API to fetch PR diff for docs action (PR #70001)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 20:21:30 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

People are currently running into issues where the files-changed step isn't able to find the merge base. This seems to happen more often on very out of date branches. This patch side steps the issue by just fetching the diff from the GH API.

---
Full diff: https://github.com/llvm/llvm-project/pull/70001.diff


1 Files Affected:

- (modified) .github/workflows/docs.yml (+4-16) 


``````````diff
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 57cb9ecf2ca1fcd..c31396822749daf 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -29,22 +29,6 @@ jobs:
     name: "Test documentation build"
     runs-on: ubuntu-latest
     steps:
-      # Fetch all the commits in a pull request + 1 so that the
-      # docs-changed-subprojects step won't pull them in itself in an extremely
-      # slow manner.
-      - name: Calculate number of commits to fetch (PR)
-        if: ${{ github.event_name == 'pull_request' }} 
-        run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
-      - name: Fetch LLVM sources (PR)
-        if: ${{ github.event_name == 'pull_request' }}
-        uses: actions/checkout at v4
-        with:
-          fetch-depth: ${{ env.PR_FETCH_DEPTH }}
-      - name: Fetch LLVM sources (push)
-        if: ${{ github.event_name == 'push' }}
-        uses: actions/checkout at v4
-        with:
-          fetch-depth: 1
       - name: Get subprojects that have doc changes
         id: docs-changed-subprojects
         uses: tj-actions/changed-files at v39
@@ -58,6 +42,10 @@ jobs:
               - 'clang-tools-extra/docs/**'
             lldb:
               - 'lldb/docs/**'
+      - name: Fetch LLVM sources
+        uses: actions/checkout at v4
+        with:
+          fetch-depth: 1
       - name: Setup Python env
         uses: actions/setup-python at v4
         with:

``````````

</details>


https://github.com/llvm/llvm-project/pull/70001


More information about the llvm-commits mailing list