You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- uses: MuXiu1997/[email protected]with:
# The version of zx to install.# example: "7.2.3"zx-version: latest# Whether to disable pre-installed dependencies.# example: "true"disable-pre-installed-dependencies: false# A list of dependencies to install.# example: "typescript \n [email protected]"dependencies: ''# A key to use for restoring and saving the internal node_modules cache.# example: "primary-key-${{ runner.os }}"cache-key: 'run-zx-${{ runner.os }}-${{ a hash of all dependencies to be installed }}'# A list of keys to use for restoring the internal node_modules cache.# example: "primary-key-${{ runner.os }}-1 \n primary-key-${{ runner.os }}",cache-restore-keys: 'run-zx-${{ runner.os }}-'# The script content to run with zx.# example: "await $`ls -al`"script: ''# The file extension of the script file.# example: "md"script-file-ext: mjs# The zx command to run.# example: "zx --quiet {0}"zx-command: 'zx {0}'
# GitHub Actions runs scripts by creating a temporary script in the ${{ runner.temp }} directory and executing it.# Therefore, we need to create symbolic links for the node_modules from setup-zx to that directory in order to use dependencies.
- name: Setup zxid: setup-zxuses: MuXiu1997/[email protected]with:
dependencies: |-[email protected]script: |- await fs.symlink(path.join(__dirname, 'node_modules'), path.join(process.env.RUNNER_TEMP, 'node_modules'))
- name: Run scriptshell: zx {0}run: | import * as core from '@actions/core' import HelloWorldNPM from 'hello-world-npm' cd('${{ github.workspace }}') // change working directory to workspace core.info(`${HelloWorldNPM.helloWorld()}`)
- name: Run script againshell: zx {0}run: | import * as core from '@actions/core' core.info('Hello again!')
This discussion was converted from issue #711 on March 27, 2024 15:41.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Run zx
( install
zx
+ install dependencies + cache dependencies + run script ) in one stepUsage
See action.yml
Basic
Setup zx for run scripts multiple times
Pre installed dependencies
Pre-installed Actions Toolkit
See pre-installed-dependencies.json
License
MIT
Beta Was this translation helpful? Give feedback.
All reactions