Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ runs:
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
mkdir -p "$HOME/.local/bin"
shell: bash

- name: Check if caching is enabled in lychee args
id: cache-check
run: |
# Check if --cache flag is present in lychee args
if [[ "${{ inputs.args }}" == *"--cache"* ]]; then
echo "Lychee --cache flag detected, enabling .lycheecache caching"
echo "cache_enabled=true" >> $GITHUB_OUTPUT
else
echo "Lychee --cache flag not detected, .lycheecache will not be cached"
echo "cache_enabled=false" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Clean up existing lychee binary
run: |
# Remove any existing lychee binary to prevent conflicts
Expand Down Expand Up @@ -102,6 +116,16 @@ runs:
# Install lychee from the temporary directory
install -t "$HOME/.local/bin" -D "${{ steps.lychee-setup.outputs.temp_dir }}/lychee"
shell: bash

- name: Restore lychee cache
id: restore-cache
if: steps.cache-check.outputs.cache_enabled == 'true'
uses: actions/cache/restore@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: v5 was recently released

with:
path: ${{ inputs.workingDirectory }}/.lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- name: Run Lychee
id: run-lychee
working-directory: ${{ inputs.workingDirectory }}
Expand All @@ -118,6 +142,14 @@ runs:
INPUT_CHECKBOX: ${{ inputs.CHECKBOX }}
INPUT_OUTPUT: ${{ inputs.OUTPUT }}
shell: bash

- name: Save lychee cache
if: steps.cache-check.outputs.cache_enabled == 'true' && !cancelled()
uses: actions/cache/save@v4
with:
path: ${{ inputs.workingDirectory }}/.lycheecache
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

branding:
icon: "external-link"
color: "purple"
Loading