Skip to content

Commit

Permalink
Use packageManager defined in package.json when yarn-version is n…
Browse files Browse the repository at this point in the history
…ot specified in yarn action
  • Loading branch information
lzm0 committed May 21, 2024
1 parent 6f1cf57 commit 0ceb1b2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions yarn/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'Build Image w/ Yarn'
description: 'Build an image using yarn'
author: 'GarnerCorp'
name: "Build Image w/ Yarn"
description: "Build an image using yarn"
author: "GarnerCorp"
branding:
icon: 'aperture'
color: 'purple'
icon: "aperture"
color: "purple"
inputs:
checkout:
description: Whether or not to checkout the repository you are currently working in
Expand All @@ -27,8 +27,7 @@ inputs:
default: "18"
required: false
yarn-version:
description: "Yarn version to use"
default: "3.6.4"
description: "Yarn version to use, if not specified, the version defined in package.json will be used"
required: false
working-directory:
description: "Directory containing package.json"
Expand Down Expand Up @@ -75,7 +74,7 @@ inputs:
required: false

runs:
using: 'composite'
using: "composite"
steps:
- name: Validate inputs (yarn berry)
if: ${{ !inputs.google-credentials-json != !inputs.google-cloud-sdk-version || (inputs.yarn-version >= '2' && !inputs.npm-username != !inputs.npm-password) }}
Expand Down Expand Up @@ -111,14 +110,17 @@ runs:
- name: Use Yarn Berry
shell: bash
if: inputs.yarn-version >= '2'
working-directory: ${{ inputs.working-directory }}
env:
yarn_version: ${{ inputs.yarn-version }}
run: |
$GITHUB_ACTION_PATH/../scripts/add-matchers.sh
if ! command -v yarn >/dev/null; then
corepack prepare yarn@stable --activate
fi
yarn set version "$yarn_version"
if [ -n "$yarn_version" ]; then
yarn set version "$yarn_version"
fi
- name: Ensure yarn is available
shell: bash
Expand Down

0 comments on commit 0ceb1b2

Please sign in to comment.