File tree Expand file tree Collapse file tree
.github/actions/gh-cache/save Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,17 +64,24 @@ runs:
6464 shell : bash
6565 run : |
6666 if [ -e "${{ inputs.path }}" ]; then
67- mkdir -p ".gh-cache-${{ github.run_id }}/$(dirname "${{ inputs.path }}")"
6867 if [ -d "${{ inputs.path }}" ]; then
68+ # For directories, copy contents to avoid nesting
6969 mkdir -p ".gh-cache-${{ github.run_id }}/${{ inputs.path }}"
70- cp -Rf "${{ inputs.path }}/." ".gh-cache-${{ github.run_id }}/${{ inputs.path }}/"
70+ # Check if directory has files before copying
71+ if [ "$(ls -A "${{ inputs.path }}" 2>/dev/null)" ]; then
72+ cp -Rf "${{ inputs.path }}"/* ".gh-cache-${{ github.run_id }}/${{ inputs.path }}"/
73+ echo "Copied directory contents of '${{ inputs.path }}' to 'gh-cache' branch"
74+ else
75+ echo "Directory '${{ inputs.path }}' is empty, nothing to copy"
76+ fi
7177 else
78+ # For files, copy file to path
79+ mkdir -p ".gh-cache-${{ github.run_id }}/$(dirname "${{ inputs.path }}")"
7280 cp -Rf "${{ inputs.path }}" ".gh-cache-${{ github.run_id }}/${{ inputs.path }}"
81+ echo "Copied file '${{ inputs.path }}' to 'gh-cache' branch"
7382 fi
74- echo "Copied '${{ inputs.path }}' to 'gh-cache' branch"
7583 else
7684 echo "'${{ inputs.path }}' does not exist"
77- echo "Skipping copy"
7885 fi
7986
8087 - name : Commit and push
You can’t perform that action at this time.
0 commit comments