From e350b744891e4f52eeb1a70e67efddc6c4ada056 Mon Sep 17 00:00:00 2001 From: David Spickett 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 9a9c8f9c65162..111fa6d7aa67e 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@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 23fab598fc77d..a52e4e9436263 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@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 99f9be771588d..aa36e6d502c95 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@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 }}' \