From b41fd1efd641fc0c7b3b1d397e077b5e72ac0c8f Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:39:39 -0500 Subject: [PATCH 1/2] Add author Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index da139e9..a435fb6 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,5 @@ name: "Check links with linkcheck" +author: filiph description: > Blazing fast localhost crawling via the linkcheck tool. branding: From a202cad4e7f2731b32081f718f70c6843e20c311 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:45:34 -0500 Subject: [PATCH 2/2] Convert to composite action --- GithubActionDockerfile | 6 --- action.yml | 77 ++++++++++++++++++++++++++++++++++++- github_action_entrypoint.sh | 6 --- 3 files changed, 75 insertions(+), 14 deletions(-) delete mode 100644 GithubActionDockerfile delete mode 100755 github_action_entrypoint.sh diff --git a/GithubActionDockerfile b/GithubActionDockerfile deleted file mode 100644 index 1782a3f..0000000 --- a/GithubActionDockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM dart - -RUN dart pub global activate linkcheck -COPY github_action_entrypoint.sh /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index a435fb6..161b16d 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,80 @@ inputs: outputs: exit_code: description: "The exit code of the linkcheck tool" + value: ${{ steps.check-links.outputs.exit-code }} runs: - using: "docker" - image: "GithubActionDockerfile" + using: "composite" + steps: + - name: set up linkcheck + id: setup + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + : Install linkcheck + os_name=$(uname|tr A-Z a-z) + case "$os_name" in + darwin) + os_name=macos;; + mingw64*) + os_name=windows;; + esac + os_arch=$(uname -m) + case "$os_arch" in + aarch64) + os_arch=arm64;; + amd64|x86_64) + os_arch=x64;; + esac + ( + cd $(mktemp -d) + platform_filter="*-$os_name-$os_arch*" + gh release download -R filiph/linkcheck -p "$platform_filter" + archive=$(ls) + case "$archive" in + *.zip) + executable=$(unzip -Z -1 "$archive" |grep -v src|tail -1) + unzip -qq "$archive" + ;; + *.tar.gz) + executable=$(tar tzf "$archive" |grep -v src|tail -1) + tar xf "$archive" + ;; + *) + echo ::error "::Unrecognized archive format for $archive (from $platform_filter)" + exit 1 + ;; + esac + if [ -z "$executable" ]; then + echo ::error "::Could not determine executable from $archive (from $platform_filter)" + exit 2 + fi + echo "linkcheck=$(pwd)/$executable" >> "$GITHUB_OUTPUT" + ) + - name: check links + id: check-links + shell: bash + env: + linkcheck: ${{ steps.setup.outputs.linkcheck }} + arguments: ${{ inputs.arguments }} + run: | + : Link Checker + ( + echo "# Link Checker" + echo "$arguments" + echo + ( + echo 0 > exit-code + "$linkcheck" $arguments || + echo $? > exit-code + ) | + tee log | + perl -pe ' + s/^([A-Z]\w+)\W+?(\s*)$/## $1$2/; + s!^(https?://)!### $1!; + s/\s{3,}/- /; + ' + ) >> "$GITHUB_STEP_SUMMARY" + cat log + echo "exit-code=$(cat exit-code)" >> "$GITHUB_OUTPUT" diff --git a/github_action_entrypoint.sh b/github_action_entrypoint.sh deleted file mode 100755 index 098c5d1..0000000 --- a/github_action_entrypoint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -sh -c "/root/.pub-cache/bin/linkcheck $INPUT_ARGUMENTS" -exit_code=$? -echo "exit_code=$exit_code" >>$GITHUB_OUTPUT -exit $exit_code \ No newline at end of file