Skip to content

Fix Cache Key Calculation in Phive Install GitHub Action#197

Merged
localheinz merged 1 commit intoergebnis:mainfrom
lotyp:fix/phive-install
Jun 7, 2024
Merged

Fix Cache Key Calculation in Phive Install GitHub Action#197
localheinz merged 1 commit intoergebnis:mainfrom
lotyp:fix/phive-install

Conversation

@lotyp
Copy link
Contributor

@lotyp lotyp commented Jun 7, 2024

Description

I've noticed a bug in the Phive install action where the cache key is incorrectly calculated. Instead of generating a hash from phars.xml, the function name is printed as a string, leading to cache failures when phars.xml is updated in a single pull request.

Current Output:

Screenshot 2024-06-07 at 21 44 48

Fix:
I updated the cache key calculation from:

key: "phive-hashFiles('**/phars.xml')"

to:

key: phive-${{ hashFiles('**/phars.xml') }}

After fix is applied:

Screenshot 2024-06-07 at 22 51 40

This should ensure the correct hash is generated and the cache is restored properly.

I encountered a similar issue in my wayofdev/gh-actions repository, which also uses Phive install inspired by your repository.

How to check cache keys?:

https://github.com/cli/cli can be used to check all cache keys of repository:

gh cache list

@localheinz localheinz self-assigned this Jun 7, 2024
@localheinz localheinz merged commit bc55f37 into ergebnis:main Jun 7, 2024
@localheinz
Copy link
Member

Thank you, @lotyp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants