-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use composite action to resolve exact npm package version (#251)
* chore: use composite action to resolve exact npm package version * fix: run schema workflows when actions change
- Loading branch information
Showing
4 changed files
with
43 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Package version | ||
description: Resolve the exact npm package version, using a semver | ||
|
||
inputs: | ||
name: | ||
description: Package name to resolve | ||
required: true | ||
|
||
semver: | ||
description: Semver version to resolve the exact version of (e.g. "latest" or "^1.0.0") | ||
default: 'latest' | ||
|
||
outputs: | ||
exact: | ||
description: The exact version of the package, resolved from semver | ||
value: ${{ steps.resolve.outputs.exact }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: 🌐 Resolve version | ||
id: resolve | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const packageRequest = '${{ inputs.name }}@${{ inputs.semver }}' | ||
const { stdout: exactVersion } = await exec.getExecOutput('npm', ['show', packageRequest, 'version']); | ||
core.setOutput('exact', exactVersion.trim()); | ||
console.log('✅ Resolved version for ${{ inputs.name }}', { packageRequest, exactVersion: exactVersion.trim() }); |
This file contains 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
This file contains 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
This file contains 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