This action makes it easy to quickly write a script in your workflow that uses the GitHub API and the workflow run context.
To use this action, provide an input named script
that contains the body of an asynchronous function call.
The following arguments will be provided:
github
A pre-authenticated octokit/rest.js client with pagination pluginscontext
An object containing the context of the workflow runcore
A reference to the @actions/core packageglob
A reference to the @actions/glob packageio
A reference to the @actions/io packageexec
A reference to the @actions/exec packagerequire
A proxy wrapper around the normal Node.jsrequire
to enable requiring relative paths (relative to the current working directory) and requiring npm packages installed in the current working directory. If for some reason you need the non-wrappedrequire
, there is an escape hatch available:__original_require__
is the original value ofrequire
without our wrapping applied.
Since the script
is just a function body, these values will already be
defined, so you don't have to import them (see examples below).
See octokit/rest.js for the API client documentation.
Version 6 of this action updated the runtime to Node 16 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-using-nodejs-v16
All scripts are now run with Node 16 instead of Node 12 and are affected by any breaking changes between Node 12 and 16.
Version 5 of this action includes the version 5 of @actions/github
and @octokit/plugin-rest-endpoint-methods
. As part of this update, the Octokit context available via github
no longer has REST methods directly. These methods are available via github.rest.*
- https://github.com/octokit/plugin-rest-endpoint-methods.js/releases/tag/v5.0.0
For example, github.issues.createComment
in V4 becomes github.rest.issues.createComment
in V5
github.request
, github.paginate
, and github.graphql
are unchanged.
See development.md.