mirror of
https://github.com/actions/github-script.git
synced 2026-02-09 04:27:25 +00:00
Document how to use env: as input
This commit is contained in:
parent
a56d4504de
commit
934655b9e0
1 changed files with 22 additions and 0 deletions
22
README.md
22
README.md
|
|
@ -294,3 +294,25 @@ jobs:
|
||||||
|
|
||||||
console.log(stdout)
|
console.log(stdout)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Use env as input
|
||||||
|
|
||||||
|
You can set env vars to use them in your script:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
echo-input:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v3
|
||||||
|
env:
|
||||||
|
FIRST_NAME: Mona
|
||||||
|
LAST_NAME: Octocat
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { FIRST_NAME, LAST_NAME } = process.env
|
||||||
|
|
||||||
|
console.log(`Hello ${FIRST_NAME} ${LAST_NAME}`)
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue