Skip to content
Open
Changes from 3 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f2f7f58
ci: Use github/setup-licensed
nschonni Jun 3, 2024
fd2cfc1
ci: pin ruby/setup-ruby
nschonni Jun 10, 2024
19e58d8
Define `permissions` in workflows and update actions
joshmgross Jan 28, 2025
8e643f1
chore: Add Dependabot for .github/actions/install-dependencies
nschonni Jan 28, 2025
ac230a1
chore: Remove .vscode settings
nschonni Jan 28, 2025
08caadd
Merge pull request #531 from actions/joshmgross/update-workflows
joshmgross Jan 29, 2025
6efc757
Merge branch 'main' into sub-action-dependabot
joshmgross Jan 29, 2025
eef4fd9
Merge branch 'main' into remove-vscode
joshmgross Jan 29, 2025
eb88965
Merge pull request #532 from nschonni/sub-action-dependabot
joshmgross Jan 29, 2025
511abaa
Merge branch 'main' into remove-vscode
joshmgross Jan 29, 2025
8cf50d1
Merge pull request #533 from nschonni/remove-vscode
joshmgross Jan 29, 2025
586a6a1
Merge branch 'main' into upstream-setup-license
joshmgross Jan 29, 2025
91a83c0
Merge pull request #473 from nschonni/upstream-setup-license
joshmgross Jan 29, 2025
4024541
make octokit instance available as octokit on top of github, to make …
iamstarkov Jan 15, 2025
f23cd47
replace GitHub with octokit in the README, but keep a note of the Git…
iamstarkov Jan 31, 2025
6320504
fix: adjust types
iamstarkov Jan 31, 2025
378a50f
Merge pull request #508 from iamstarkov/patch-2
joshmgross Feb 4, 2025
86ac137
docs: add "exec" usage examples
neilime Feb 17, 2025
851500a
Remove `octokit` README updates for v7
joshmgross Feb 26, 2025
d0bdaba
Merge pull request #557 from actions/joshmgross/fix-readme-v7
joshmgross Feb 26, 2025
ea54302
Merge branch 'actions:main' into patch-1
neilime Mar 4, 2025
62c3794
Merge pull request #546 from neilime/patch-1
joshmgross Mar 5, 2025
14b73c4
Bump ruby/setup-ruby from 1.213.0 to 1.222.0
dependabot[bot] Mar 10, 2025
3908079
Merge pull request #563 from actions/dependabot/github_actions/ruby/s…
joshmgross Mar 10, 2025
5b5837a
Bump ruby/setup-ruby from 1.222.0 to 1.229.0
dependabot[bot] Mar 31, 2025
e7aeb8c
Merge pull request #575 from actions/dependabot/github_actions/ruby/s…
joshmgross Apr 2, 2025
f9d8109
Clearly document passing inputs to the `script`
joshmgross May 13, 2025
3424b52
typo fixes
joshmgross May 13, 2025
5ee2b97
Merge pull request #603 from actions/joshmgross/document-inputs
joshmgross May 14, 2025
1ae9958
Update README.md
nebuk89 Jun 2, 2025
f28e40c
Merge pull request #610 from actions/nebuk89-patch-1
nebuk89 Jun 6, 2025
2c81ba0
Update Node.js version support to 24.x
salmanmkc Jul 29, 2025
e7b7f22
update licenses
salmanmkc Aug 8, 2025
20fe497
Merge pull request #637 from actions/node24
salmanmkc Sep 4, 2025
adc0eea
README for updating actions/github-script from v7 to v8
sneha-krip Sep 4, 2025
8b222ac
Apply suggestion from @salmanmkc
sneha-krip Sep 4, 2025
01e118c
Update README for Node 24 runtime requirements
sneha-krip Sep 4, 2025
2dc352e
Bold minimum Actions Runner version in README
sneha-krip Sep 4, 2025
ed59741
Merge pull request #653 from actions/sneha-krip/readme-for-v8
sneha-krip Sep 4, 2025
e6664bd
git script
granjacours410-source Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,31 @@ For example, `github.issues.createComment` in V4 becomes `github.rest.issues.cre

See [development.md](/docs/development.md).

## Passing inputs to the script

Actions expressions are evaluated before the `script` is passed to the action, so the result of any expressions
*will be evaluated as JavaScript code*.

It's highly recommended to *not* evaluate expressions directly in the `script` to avoid
[script injections](https://docs.github.com/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections)
and potential `SyntaxError`s when the expression is not valid JavaScript code (particularly when it comes to improperly escaped strings).

To pass inputs, set `env` vars on the action step and reference them in your script with `process.env`:

```yaml
- uses: actions/github-script@v7
env:
TITLE: ${{ github.event.pull_request.title }}
with:
script: |
const title = process.env.TITLE;
if (title.startsWith('octocat')) {
console.log("PR title starts with 'octocat'");
} else {
console.error("PR title did not start with 'octocat'");
}
```

## Reading step results

The return value of the script will be in the step's outputs under the
Expand Down Expand Up @@ -444,27 +469,6 @@ export default async ({ core, context }) => {
};
```

### 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@v7
env:
FIRST_NAME: Mona
LAST_NAME: Octocat
with:
script: |
const { FIRST_NAME, LAST_NAME } = process.env

console.log(`Hello ${FIRST_NAME} ${LAST_NAME}`)
```

### Using a separate GitHub token

Expand Down
Loading