back to home

actions / github-script

Write workflows scripting the GitHub API in JavaScript

4,900 stars
546 forks
89 issues
TypeScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing actions/github-script in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/actions/github-script)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

actions/github-script This action makes it easy to quickly write a script in your workflow that uses the GitHub API and the workflow run context. Note Thank you for your interest in this GitHub action, however, right now we are not taking contributions. We continue to focus our resources on strategic areas that help our customers be successful while making developers' lives easier. While GitHub Actions remains a key part of this vision, we are allocating resources towards other areas of Actions and are not taking contributions to this repository at this time. The GitHub public roadmap is the best place to follow along for any updates on features we’re working on and what stage they’re in. We are taking the following steps to better direct requests related to GitHub Actions, including: • We will be directing questions and support requests to our Community Discussions area • High Priority bugs can be reported through Community Discussions or you can report these to our support team https://support.github.com/contact/bug-report. • Security Issues should be handled as per our security.md We will still provide security updates for this project and fix major breaking changes during this time. You are welcome to still raise bugs in this repo. This action To use this action, provide an input named that contains the body of an asynchronous JavaScript function call. The following arguments will be provided: • A pre-authenticated octokit/rest.js client with pagination plugins • An object containing the context of the workflow run • A reference to the @actions/core package • A reference to the @actions/glob package • A reference to the @actions/io package • A reference to the @actions/exec package • A proxy wrapper around the normal Node.js 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-wrapped , there is an escape hatch available: is the original value of without our wrapping applied. Since the 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. Breaking Changes V8 Version 8 of this action updated the runtime to Node 24 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions All scripts are now run with Node 24 instead of Node 20 and are affected by any breaking changes between Node 20 and 24. **This requires a minimum Actions Runner version of v2.327.1** V7 Version 7 of this action updated the runtime to Node 20 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions All scripts are now run with Node 20 instead of Node 16 and are affected by any breaking changes between Node 16 and 20 The input now only applies to GraphQL API calls as REST API previews are no longer necessary - https://github.blog/changelog/2021-10-14-rest-api-preview-promotions/. V6 Version 6 of this action updated the runtime to Node 16 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions All scripts are now run with Node 16 instead of Node 12 and are affected by any breaking changes between Node 12 and 16. V5 Version 5 of this action includes the version 5 of and . As part of this update, the Octokit context available via no longer has REST methods directly. These methods are available via - https://github.com/octokit/plugin-rest-endpoint-methods.js/releases/tag/v5.0.0 For example, in V4 becomes in V5 , , and are unchanged. Development See development.md. Passing inputs to the script Actions expressions are evaluated before the 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 to avoid script injections and potential s when the expression is not valid JavaScript code (particularly when it comes to improperly escaped strings). To pass inputs, set vars on the action step and reference them in your script with : Reading step results The return value of the script will be in the step's outputs under the "result" key. See "Result encoding" for details on how the encoding of these outputs can be changed. Result encoding By default, the JSON-encoded return value of the function is set as the "result" in the output of a github-script step. For some workflows, string encoding is preferred. This option can be set using the input: Retries By default, requests made with the instance will not be retried. You can configure this with the option: In this example, request failures from will be retried up to 3 times. You can also configure which status codes should be exempt from retries via the option: By default, the following status codes will not be retried: (source). These retries are implemented using the octokit/plugin-retry.js plugin. The retries use exponential backoff to space out retries. (source) Examples Note that is optional in this action, and the input is there in case you need to use a non-default token. By default, github-script will use the token provided to your workflow. Print the available attributes of context Comment on an issue Apply a label to an issue Welcome a first-time contributor You can format text in comments using the same Markdown syntax as the GitHub web interface: Download data from a URL You can use the object to access the Octokit API. For instance, _(Note that this particular example only works for a public URL, where the diff URL is publicly accessible. Getting the diff for a private URL requires using the API.)_ This will print the full diff object in the screen; will contain the actual diff text. Run custom GraphQL queries You can use the object to run custom GraphQL queries against th…