Skip to content

Commit 0cbe506

Browse files
committed
fix: Only commit file if it exists
1 parent 28ccb7f commit 0cbe506

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/actions/gh-cache/save/action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ runs:
4141
shell: bash
4242
working-directory: .gh-cache-${{ github.run_id }}
4343
run: |
44-
git add "${{ inputs.path }}"
45-
git config user.name "github-actions[bot]"
46-
git config user.email "github-actions[bot]@users.noreply.github.com"
47-
git commit -m "$(printf 'Save artifact: %s' "${{ inputs.path }}")" || echo "No changes to commit"
48-
git push origin gh-cache
44+
if [ -e "${{ inputs.path }}" ]; then
45+
git add "${{ inputs.path }}"
46+
git config user.name "github-actions[bot]"
47+
git config user.email "github-actions[bot]@users.noreply.github.com"
48+
git commit -m "$(printf 'Save artifact: %s' "${{ inputs.path }}")" || echo "No changes to commit"
49+
git push origin gh-cache
50+
fi
4951
5052
- name: Clean up temporary directory
5153
shell: bash

0 commit comments

Comments
 (0)