@@ -29,6 +29,10 @@ inputs:
2929 description : ' Maximum number of retries for the `yarn --immutable` install command.'
3030 required : false
3131 default : ' 5'
32+ yarn-custom-url :
33+ description : ' Optional custom URL for a Yarn bundle to be prepared and activated by Corepack. For CI testing.'
34+ required : false
35+ default : ' '
3236
3337# The outputs are for the unit tests in `build-lint-test.yml`, and
3438# probably not useful for other workflows.
@@ -72,13 +76,23 @@ runs:
7276 run : echo "actual-commit-hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
7377 shell : bash
7478
75- # Enable global allow Yarn installation from a custom URL
76- - run : echo "COREPACK_ENABLE_UNSAFE_CUSTOM_URLS=1" >> $GITHUB_ENV
79+ - name : Enable global allow Yarn installation from a custom URL
80+ if : ${{ inputs.yarn-custom-url != '' }}
81+ run : echo "COREPACK_ENABLE_UNSAFE_CUSTOM_URLS=1" >> $GITHUB_ENV
7782 shell : bash
7883
7984 - run : corepack enable
8085 shell : bash
8186
87+ # Prepare and activate custom Yarn if URL is provided.
88+ # This runs *before* setup-node might try to cache a standard Yarn.
89+ - name : Prepare and activate custom Yarn
90+ if : ${{ inputs.yarn-custom-url != '' }}
91+ run : |
92+ echo "Preparing and activating custom Yarn from URL: ${{ inputs.yarn-custom-url }}"
93+ corepack prepare yarn@${{ inputs.yarn-custom-url }} --activate
94+ shell : bash
95+
8296 # In a low-risk environment, try to download cache of `node_modules`, if it
8397 # exists. On failure, will run the `yarn` command instead.
8498 - name : Download node_modules cache
0 commit comments