Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
a819335c68 |
11
action.yaml
Normal file
11
action.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
inputs:
|
||||
name:
|
||||
description: 'Artifact name'
|
||||
path:
|
||||
description: 'Destination path'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: download artifacts
|
||||
run: ${{ gitea.action_path }}/entrypoint.sh
|
20
entrypoint.sh
Executable file
20
entrypoint.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
curl --fail -v -D /dev/stdout -o resp0.json --header "Authorization: Bearer ${{ inputs.token }}" \
|
||||
"${{ gitea.server_url }}/api/actions_pipeline/_apis/pipelines/workflows/${{ gitea.run_id }}/artifacts?api-version=6.0-preview"
|
||||
cat resp0.json
|
||||
container_url=$(jq -r '.value.[] | select(.name == "${{ inputs.name }}").fileContainerResourceUrl' resp0.json)
|
||||
echo $container_url
|
||||
rm resp0.json
|
||||
artifact_urlencode=$(echo "${{ inputs.name }}" | jq -Rr '@uri')
|
||||
echo $artifact_urlencode
|
||||
curl --fail -v -D /dev/stdout -o resp1.json --header "Authorization: Bearer ${{ inputs.token }}" \
|
||||
"$container_url?itemPath=$artifact_urlencode"
|
||||
cat resp1.json
|
||||
for key in $(jq -r '.value[].path' resp1.json); do
|
||||
artifact_url=$(jq -r ".value[] | select(.path == \"$key\").contentLocation" resp1.json)
|
||||
key_urlencode=$(echo $key | jq -Rr '@uri')
|
||||
curl --fail -v -D /dev/stdout -o "${{ inputs.path }}/$key" --create-dirs --header "Authorization: Bearer ${{ inputs.token }}" \
|
||||
"$artifact_url?itemPath=$key_urlencode"
|
||||
done
|
||||
rm resp1.json
|
Loading…
Reference in New Issue
Block a user