-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael M
committed
Oct 27, 2023
1 parent
34d01b2
commit f1f9c92
Showing
7 changed files
with
94 additions
and
64 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,82 @@ | ||
name: Action for Node.js & cache | ||
description: Node.js setup and cache | ||
|
||
inputs: | ||
node-version: | ||
description: Node.js version | ||
required: false | ||
default: 18.x | ||
|
||
outputs: | ||
root-package-version: | ||
description: Full version from root package.json | ||
value: ${{ steps.output.outputs.root-package-version }} | ||
root-package-major-version: | ||
description: Major version from root package.json | ||
value: ${{ steps.output.outputs.root-package-major-version }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Additional debug logs | ||
shell: bash | ||
run: | | ||
echo "github.workflow: ${{ github.workflow }}" | ||
echo "github.sha: ${{ github.sha }}" | ||
echo "github.ref: ${{ github.ref }}" | ||
echo "github.ref_name: ${{ github.ref_name }}" | ||
echo "github.ref_type: ${{ github.ref_type }}" | ||
echo "github.base_ref: ${{ github.base_ref }}" | ||
echo "github.head_ref: ${{ github.head_ref }}" | ||
echo "github.run_id: ${{ github.run_id }}" | ||
echo "github.run_number: ${{ github.run_number }}" | ||
echo "github.run_attempt: ${{ github.run_attempt }}" | ||
echo "github.event.number: ${{ github.event.number }}" | ||
echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}" | ||
echo "github.event.pull_request.head.repo.full_name: ${{ github.event.pull_request.head.repo.full_name }}" | ||
Check failure Code scanning / CodeQL Expression injection in Actions Critical
Potential injection from the ${{ github.head_ref }}, which may be controlled by an external user.
Potential injection from the ${{ github.event.pull_request.head.ref }}, which may be controlled by an external user. |
||
- name: Use Node.js ${{ inputs.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Restore node_modules from cache | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
**/node_modules/ | ||
!**/node_modules/.cache | ||
key: modules-cache__nodejs-${{ inputs.node-version }}__${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Restore from global npm cache | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: npm-cache__nodejs-${{ inputs.node-version }}__${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm-cache-hash__ | ||
|
||
- shell: bash | ||
run: | | ||
echo "Environment info: Node.js, npm" | ||
node -v | ||
npm -v | ||
- shell: bash | ||
run: | | ||
echo "Providing global variables" | ||
echo "TIMING=true" >> $GITHUB_ENV | ||
echo "NPM_CONFIG_CACHE=~/.npm" >> $GITHUB_ENV | ||
- name: Clean install dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: npm ci | ||
shell: bash | ||
|
||
- id: output | ||
shell: bash | ||
run: | | ||
echo "root-package-version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | ||
echo "root-package-major-version=$(node -p "parseInt(require('./package.json').version)")" >> $GITHUB_OUTPUT |
This file was deleted.
Oops, something went wrong.
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
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