[llvm] [GitHub] Add --fail to curl commands (PR #72238)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 02:22:02 PST 2023


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

This means that if we try to download a missing file, we do not get a document with the same file name, but containing only the http response code.

```
$ curl -O -L --fail https://raw.githubusercontent.com/llvm/llvm-project/main/.github/workflows/not-a-file.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
$ $?
22: command not found
```

Which will be less confusing than python complaining about the file contents.

>From d5fb75f1e39e5a920c7a06bfc3cfe06a045bd756 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 14 Nov 2023 10:15:28 +0000
Subject: [PATCH] [GitHub] Add --fail to curl commands

This means that if we try to download a missing file, we do not
get a document with the same file name, but containing only
the http response code.

```
$ curl -O -L --fail https://raw.githubusercontent.com/llvm/llvm-project/main/.github/workflows/not-a-file.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
$ $?
22: command not found
```

Which will be less confusing than python complaining about the file
contents.
---
 .github/workflows/issue-subscriber.yml | 4 ++--
 .github/workflows/pr-subscriber.yml    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/issue-subscriber.yml b/.github/workflows/issue-subscriber.yml
index 589142b20607c43..9a9c8f9c65162b5 100644
--- a/.github/workflows/issue-subscriber.yml
+++ b/.github/workflows/issue-subscriber.yml
@@ -15,8 +15,8 @@ jobs:
     steps:
       - name: Setup Automation Script
         run: |
-          curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/github-automation.py
-          curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/"$GITHUB_SHA"/llvm/utils/git/requirements.txt
+          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
 
diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml
index 03f60f619568f11..99f9be771588d9e 100644
--- a/.github/workflows/pr-subscriber.yml
+++ b/.github/workflows/pr-subscriber.yml
@@ -15,8 +15,8 @@ jobs:
     steps:
       - name: Setup Automation Script
         run: |
-          curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/github-automation.py
-          curl -O -L https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/requirements.txt
+          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
 



More information about the llvm-commits mailing list