[llvm] [Github] Force changed files step to use GH API for code formatting (PR #69766)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 13:37:23 PDT 2023


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

>From a898e077df412d2b54072d4f5e288e98d8baa98a Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Fri, 20 Oct 2023 12:58:22 -0700
Subject: [PATCH] [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.
---
 .github/workflows/pr-code-format.yml | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 3a91ffb0b1ad9a7..2f66b6f21fe3272 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -7,17 +7,20 @@ jobs:
   code_formatter:
     runs-on: ubuntu-latest
     steps:
-      - name: Fetch LLVM sources
-        uses: actions/checkout at v4
-        with:
-          fetch-depth: 2
-
+      # Get changed files before we do a checkout to force the action to use
+      # the GH API to look for changed files and avoid an expensive partial
+      # fetch operation.
       - name: Get changed files
         id: changed-files
         uses: tj-actions/changed-files at v39
         with:
           separator: ","
-          fetch_depth: 100 # Fetches only the last 10 commits
+
+      - name: Fetch LLVM sources
+        uses: actions/checkout at v4
+        with:
+          fetch-depth: ${{ github.event.pull_request.commits }}
+          ref: ${{ github.event.pull_request.head.ref }}
 
       - name: "Listed files"
         run: |



More information about the llvm-commits mailing list