Skip to content

Commit

Permalink
add fixed-key functionality cross-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
assignUser committed Feb 19, 2024
1 parent 7f8038d commit f9994d3
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion restore/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,31 @@ runs:
else
echo "stash_exists=false" >> $GITHUB_OUTPUT
fi
- name: Check across repo
if: ${{ ! steps.check-stash.outputs.stash_name }}
shell: bash
run: |
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-f name=${{ inputs.key }} \
--method=get \
/repos/${{ github.repository }}/actions/artifacts > res.json
stash_name=$(jq '.artifacts
| map(select(.name | test ("${{ inputs.key }}")))
| max_by(.updated_at)
| .name // empty' res.json)
if [ -z "$stash_name" ]; then
echo "stash_name=$stash_name" >> $GITHUB_OUTPUT
else
exit 1
fi
- name: Download Stash from current workflow
if: ${{ steps.check-stash.outputs.stash_exists }}
id: upload
uses: actions/download-artifact@v4
with:
name: ${{ steps.check-stash.outputs.stash_name || inputs.key }}
path: ${{ inputs.path }}
token: ${{ inputs.token }}

0 comments on commit f9994d3

Please sign in to comment.