Open
Conversation
Avoid Corepack download message breaking the env file (tail -n1).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 References
📝 Implementation
Problem: In repos with "packageManager": "yarn@4.12.0" (e.g. dhis2-app-skeleton), the test job fails because the first use of yarn (e.g. in "Get yarn cache directory path") happens before Corepack is enabled, so the runner falls back to Yarn 1.x.
Changes in .github/workflows/app-test.yml:
Removed cache: "yarn" from the "Setup Node.js version from .nvmrc" step so yarn is not run before enabling Corepack.
Added an "Enable Corepack" step (corepack enable) right after setting up Node and before any yarn command.
Result: With Corepack enabled, repos without packageManager keep using Yarn 1.x; repos with packageManager use the specified version (e.g. Yarn 4). Dependency caching is unchanged and still done in "Get yarn cache directory path" and "Cache yarn dependencies".
📹 Screenshots/Screen capture
🔥 Testing
Run the workflow on a Yarn 1 repo (no packageManager): it should still pass.
Run the workflow on a Yarn 4 repo with packageManager (e.g. dhis2-app-skeleton): the "Unit tests" job should pass; previously it failed at "Setup Node.js version from .nvmrc" / "Get yarn cache directory path" with the Corepack error.