diff --git a/.changes/fix-cache-path.md b/.changes/fix-cache-path.md new file mode 100644 index 0000000..2cd3d2e --- /dev/null +++ b/.changes/fix-cache-path.md @@ -0,0 +1,4 @@ +--- +kind: fixed +--- +Use a normalized absolute path for the binary cache so the save step works for `uses: ./` self-invocation (github.action_path ends in `/.`, which actions/cache rejected as an invalid pattern, silently skipping the save) diff --git a/action.yml b/action.yml index 0623cda..82ec531 100644 --- a/action.yml +++ b/action.yml @@ -89,12 +89,15 @@ runs: h=$(find . -type f \( -name '*.go' -o -name 'go.mod' -o -name 'go.sum' \) \ -print0 | sort -z | xargs -0 sha256sum | sha256sum | awk '{print $1}') echo "hash=$h" >> "$GITHUB_OUTPUT" + # Emit a normalized absolute path: github.action_path ends in "/." for + # `uses: ./`, and actions/cache rejects any path containing "/./". + echo "binpath=$(pwd -P)/release-tool" >> "$GITHUB_OUTPUT" - name: Restore release-tool binary id: cache-bin uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - path: ${{ github.action_path }}/release-tool + path: ${{ steps.srchash.outputs.binpath }} key: release-tool-${{ runner.os }}-${{ runner.arch }}-go${{ inputs.go-version }}-${{ steps.srchash.outputs.hash }} - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0