Skip to content

Commit

Permalink
gh-actions/fetch: Add path arg
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax committed Oct 28, 2023
1 parent da20c78 commit ccfb8ec
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gh-actions/fetch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ inputs:
url:
type: string
required: true
path:
type: string

outputs:
path:
Expand All @@ -13,8 +15,13 @@ runs:
steps:
- run: |
echo "FETCH ${{ inputs.url }}"
tmpdir=$(mktemp -d)
cd "$tmpdir"
if [[ -n "${{ inputs.path }}" ]]; then
path="${{ inputs.path }}"
else
path=$(mktemp -d)
fi
mkdir -p "$path"
cd "$path"
curl -sLO "${{ inputs.url }}"
filepath="$(realpath "$(basename "${{ inputs.url }}")")"
echo "path=${filepath}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit ccfb8ec

Please sign in to comment.