This commit is contained in:
ange 2025-06-08 06:22:22 +00:00
parent 5d6d47f502
commit a819335c68
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 31 additions and 0 deletions

11
action.yaml Normal file
View 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
View 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