Skip to content

Commit 52af768

Browse files
authored
Use temporary directory for lychee installation (#287)
Fixes #285
1 parent 6f793a7 commit 52af768

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

action.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,19 @@ runs:
5757
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
5858
mkdir -p "$HOME/.local/bin"
5959
shell: bash
60-
- name: Clean up existing lychee files
60+
- name: Clean up existing lychee binary
6161
run: |
62-
# Remove any existing lychee binaries or archives to prevent conflicts
62+
# Remove any existing lychee binary to prevent conflicts
6363
rm -f "$HOME/.local/bin/lychee"
64-
rm -rf lychee
65-
rm -f "${{ steps.lychee-filename.outputs.filename }}"
6664
shell: bash
67-
- name: Download and extract lychee
65+
- name: Download and extract lychee in temp directory
6866
id: lychee-setup
6967
run: |
68+
# Create a temporary directory for downloads and extraction
69+
TEMP_DIR="${RUNNER_TEMP}/lychee-download"
70+
mkdir -p "${TEMP_DIR}"
71+
cd "${TEMP_DIR}"
72+
7073
ARCH=$(uname -m)
7174
# Determine filename and download URL based on version
7275
if [[ "${LYCHEE_VERSION}" =~ ^v0\.0|^v0\.1[0-5]\. ]]; then
@@ -89,21 +92,15 @@ runs:
8992
echo "Extracting ${FILENAME}"
9093
tar -xvzf "${FILENAME}"
9194
92-
# Output filename for use in later steps
93-
echo "filename=${FILENAME}" >> $GITHUB_OUTPUT
95+
# Output temp directory for use in later steps
96+
echo "temp_dir=${TEMP_DIR}" >> $GITHUB_OUTPUT
9497
env:
9598
LYCHEE_VERSION: ${{ inputs.lycheeVersion }}
9699
shell: bash
97100
- name: Install lychee
98101
run: |
99-
install -t "$HOME/.local/bin" -D lychee
100-
shell: bash
101-
- name: Clean up installation files
102-
run: |
103-
# Remove the downloaded archive and any unnecessary files after installation
104-
rm -f "${{ steps.lychee-setup.outputs.filename }}"
105-
shopt -s extglob
106-
rm -f lychee!(*-bin|*-lib|*.toml)
102+
# Install lychee from the temporary directory
103+
install -t "$HOME/.local/bin" -D "${{ steps.lychee-setup.outputs.temp_dir }}/lychee"
107104
shell: bash
108105
- name: Run Lychee
109106
id: run-lychee

0 commit comments

Comments
 (0)