Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect cached folders from multiple directories #15

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

dsame
Copy link

@dsame dsame commented Jun 6, 2023

Description:
A twin for actions#735

Related issue:
Add link to the related issue.

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@dsame dsame force-pushed the project-dir branch 4 times, most recently from 001e87e to 49b76fb Compare June 6, 2023 13:53
.github/workflows/yarn-subprojects.yml Outdated Show resolved Hide resolved
.github/workflows/yarn-subprojects.yml Outdated Show resolved Hide resolved
src/cache-restore.ts Show resolved Hide resolved
@@ -36,12 +36,12 @@ export const restoreCache = async (
);
}

const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
const primaryKey = `node-cache-${platform}-${packageManager}-v2-${fileHash}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change the key. We do not need to change key because if customers get different cache paths it will resave cache so we can keep cache key as it is.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaksimZhukov what's your opinion?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this, as suggested by Dmitry

src/cache-save.ts Outdated Show resolved Hide resolved
src/cache-utils.ts Outdated Show resolved Hide resolved
Comment on lines 144 to 145
.filter(fs.existsSync)
.filter(directory => fs.lstatSync(directory).isDirectory());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets combine this filters.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikolai-laevskii your opnion?

Copy link

@nikolai-laevskii nikolai-laevskii Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-shibanov I previously asked to separate these filters for better readability. Is there a reason why we might want them to be combined?

src/cache-utils.ts Outdated Show resolved Hide resolved
// not he wanted, thus we should throw an error not trying to workaround with unexpected
// result to the whole build
if (existingDirectories.length === 0)
throw Error(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change it to warning.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the motivation in the comment explaining why there should be an error the changing it to waring implies returning empty array that will cause the vague error anyway https://github.com/actions/toolkit/blob/main/packages/cache/src/cache.ts#L27

I need one more confirmation throwing the error should be replaced with warning

src/cache-utils.ts Outdated Show resolved Hide resolved
@dsame dsame force-pushed the project-dir branch 5 times, most recently from 2308e96 to e6a6894 Compare June 8, 2023 12:18
@dsame dsame force-pushed the project-dir branch 3 times, most recently from 8951c11 to f792668 Compare June 16, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants