[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:05:20 PDT 2023


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

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.

>From c76ed5d266a9c62d410991dfe2f9a6d554c9ede8 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 | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 3a91ffb0b1ad9a7..46ca247578d80a3 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -7,17 +7,19 @@ 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: 2
 
       - name: "Listed files"
         run: |



More information about the llvm-commits mailing list