From 37a874629ed4dceceb99bdde543d9a30425aba50 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 11 Jun 2024 17:26:39 +0200 Subject: [PATCH 1/4] Remove trailing space Signed-off-by: Johannes Schindelin --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 8cdcb75..3feb57c 100644 --- a/action.yml +++ b/action.yml @@ -51,7 +51,7 @@ runs: curl -sLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" tar -xvzf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" rm "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - install -t "$HOME/.local/bin" -D lychee + install -t "$HOME/.local/bin" -D lychee rm lychee echo "$HOME/.local/bin" >> "$GITHUB_PATH" shell: bash From f533887908732e2e78ab7f5ba6e31114f3b1ed20 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Aug 2024 13:26:53 +0200 Subject: [PATCH 2/4] Download more carefully When the download failed, we should not just go on trying to un-tar a 404 error page. Signed-off-by: Johannes Schindelin --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 3feb57c..2273afb 100644 --- a/action.yml +++ b/action.yml @@ -48,7 +48,7 @@ runs: run: | # Cleanup artifacts from previous run in case it crashed rm -rf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" lychee - curl -sLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" + curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" tar -xvzf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" rm "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" install -t "$HOME/.local/bin" -D lychee From daa71d1655f4069510f56b5b409485217875e9b3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Aug 2024 13:32:24 +0200 Subject: [PATCH 3/4] DRY up the lengthy `.tar` file name The name of the `.tar` file is repeated multiple times, verbatim. This not only violates the Don't Repeat Yourself (DRY) principle, it also makes it easier to miss an instance when the file name changes (as it did with https://github.com/lycheeverse/lychee/pull/1464). Signed-off-by: Johannes Schindelin --- action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2273afb..9531287 100644 --- a/action.yml +++ b/action.yml @@ -48,9 +48,10 @@ runs: run: | # Cleanup artifacts from previous run in case it crashed rm -rf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" lychee - curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - tar -xvzf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" - rm "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" + filename='lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz' + curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/$filename" + tar -xvzf "$filename" + rm "$filename" install -t "$HOME/.local/bin" -D lychee rm lychee echo "$HOME/.local/bin" >> "$GITHUB_PATH" From 4b661b37280899899137fb5fcd01b024db08877e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Aug 2024 13:42:22 +0200 Subject: [PATCH 4/4] Work around new naming scheme Until version 0.15.1, the naming scheme of the release assets let them start with `lychee--`. This is no longer the case as of https://github.com/lycheeverse/lychee/pull/1464, though, breaking the `lychee-action`. Since we need to allow using older versions, still, we are now stuck with a really ugly `case` construct, but this is still far better than having a broken GitHub Action. Signed-off-by: Johannes Schindelin --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9531287..dd2ba44 100644 --- a/action.yml +++ b/action.yml @@ -48,7 +48,10 @@ runs: run: | # Cleanup artifacts from previous run in case it crashed rm -rf "lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz" lychee - filename='lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz' + case '${{ inputs.LYCHEEVERSION }}' in + v0.0*|v0.1[0-5].*) filename='lychee-${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz';; + *) filename='lychee-x86_64-unknown-linux-gnu.tar.gz' + esac curl -sfLO "https://github.com/lycheeverse/lychee/releases/download/${{ inputs.LYCHEEVERSION }}/$filename" tar -xvzf "$filename" rm "$filename"