File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,26 @@ runs:
5656 exit 1
5757 fi
5858
59- - name : Perform action
59+ - name : Perform action
6060 run : |
6161 if [ "${{ inputs.action }}" = "download" ]; then
6262 curl -L \
6363 -H "Accept: application/vnd.github+json" \
6464 -H "Authorization: Bearer ${{ inputs.token }}" \
6565 -H "X-GitHub-Api-Version: 2022-11-28" \
66- https://api.github.com/repos/${{ inputs.state_repo }}/contents/${{ inputs.state_path_remote }} > ${{ inputs.state_path_local }}.response
67- jq -r '.content' ${{ inputs.state_path_local }}.response | base64 --decode > ${{ inputs.state_path_local }}
68- echo "sha=$(jq -r '.sha' ${{ inputs.state_path_local }}" >> $GITHUB_OUTPUT
66+ -o ${{ inputs.state_path_local }}.response \
67+ -w "%{http_code}" \
68+ https://api.github.com/repos/${{ inputs.state_repo }}/contents/${{ inputs.state_path_remote }} > response_code
69+ HTTP_CODE=$(cat response_code)
70+ if [ "$HTTP_CODE" -eq 200 ]; then
71+ jq -r '.content' ${{ inputs.state_path_local }}.response | base64 --decode > ${{ inputs.state_path_local }}
72+ echo "sha=$(jq -r '.sha' ${{ inputs.state_path_local }}.response)" >> $GITHUB_OUTPUT
73+ elif [ "$HTTP_CODE" -eq 404 ]; then
74+ echo "File not found, skipping download."
75+ else
76+ echo "Error: Received HTTP code $HTTP_CODE" >&2
77+ exit 1
78+ fi
6979 elif [ "${{ inputs.action }}" = "upload" ]; then
7080 if [ -z "${{ inputs.sha }}" ]; then
7181 echo "Error: sha input is required for upload action" >&2
You can’t perform that action at this time.
0 commit comments