[llvm] [GitHub][workflows] Replace curl with sparse checkout (PR #78303)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 07:59:49 PST 2024


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/78303

None

>From e350b744891e4f52eeb1a70e67efddc6c4ada056 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 16 Jan 2024 15:58:18 +0000
Subject: [PATCH] [GitHub][workflows] Replace curl with sparse checkout

---
 .github/workflows/issue-subscriber.yml | 10 ++++++++--
 .github/workflows/new-prs.yml          | 10 ++++++++--
 .github/workflows/pr-subscriber.yml    | 10 ++++++++--
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/issue-subscriber.yml b/.github/workflows/issue-subscriber.yml
index 9a9c8f9c65162b..111fa6d7aa67e7 100644
--- a/.github/workflows/issue-subscriber.yml
+++ b/.github/workflows/issue-subscriber.yml
@@ -13,14 +13,20 @@ jobs:
     runs-on: ubuntu-latest
     if: github.repository == 'llvm/llvm-project'
     steps:
+      - name: Checkout Automation Script
+        uses: actions/checkout at v4
+        with:
+          sparse-checkout: llvm/utils/git/
+          ref: main
+
       - name: Setup Automation Script
+        working-directory: ./llvm/utils/git/
         run: |
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/github-automation.py
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/requirements.txt
           chmod a+x github-automation.py
           pip install -r requirements.txt
 
       - name: Update watchers
+        working-directory: ./llvm/utils/git/
         # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
         env:
           LABEL_NAME: ${{ github.event.label.name }}
diff --git a/.github/workflows/new-prs.yml b/.github/workflows/new-prs.yml
index 23fab598fc77db..a52e4e94362630 100644
--- a/.github/workflows/new-prs.yml
+++ b/.github/workflows/new-prs.yml
@@ -34,14 +34,20 @@ jobs:
       (github.event.pull_request.author_association != 'MEMBER') &&
       (github.event.pull_request.author_association != 'OWNER')
     steps:
+      - name: Checkout Automation Script
+        uses: actions/checkout at v4
+        with:
+          sparse-checkout: llvm/utils/git/
+          ref: main
+
       - name: Setup Automation Script
+        working-directory: ./llvm/utils/git/
         run: |
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/github-automation.py
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/requirements.txt
           chmod a+x github-automation.py
           pip install -r requirements.txt
 
       - name: Greet Author
+        working-directory: ./llvm/utils/git/
         run: |
           ./github-automation.py \
             --token '${{ secrets.GITHUB_TOKEN }}' \
diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml
index 99f9be771588d9..aa36e6d502c956 100644
--- a/.github/workflows/pr-subscriber.yml
+++ b/.github/workflows/pr-subscriber.yml
@@ -13,14 +13,20 @@ jobs:
     runs-on: ubuntu-latest
     if: github.repository == 'llvm/llvm-project'
     steps:
+      - name: Checkout Automation Script
+        uses: actions/checkout at v4
+        with:
+          sparse-checkout: llvm/utils/git/
+          ref: main
+
       - name: Setup Automation Script
+        working-directory: ./llvm/utils/git/
         run: |
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/github-automation.py
-          curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/requirements.txt
           chmod a+x github-automation.py
           pip install -r requirements.txt
 
       - name: Update watchers
+        working-directory: ./llvm/utils/git/
         run: |
           ./github-automation.py \
             --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \



More information about the llvm-commits mailing list