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

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 21:32:48 PDT 2023


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

>From 88c33e56f38a37d4877ef876fcbca6e956a48831 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Mon, 23 Oct 2023 20:16:30 -0700
Subject: [PATCH] [Github] Use API to fetch PR diff for docs action

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.
---
 .github/workflows/docs.yml | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 6ee66c938cdf543..0f2da75a6844a7d 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -33,22 +33,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
@@ -66,6 +50,10 @@ jobs:
               - 'libunwind/docs/**'
             libcxx:
               - 'libcxx/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:



More information about the llvm-commits mailing list