| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hello from actions/github-script! (fe5245d) |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR exposes getOctokit in the github-script runtime context so user scripts can create additional authenticated Octokit clients (e.g., for multi-token workflows) without relying on require('@actions/github').
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main.ts | Adds getOctokit to the object passed into callAsyncFunction so scripts can access it. |
| src/async-function.ts | Updates the script context type (AsyncFunctionArguments) to type getOctokit and imports Octokit types. |
src/main.ts:71
github,
octokit: github,
getOctokit,
context,
core,
src/async-function.ts:20
import {GitHub} from '@actions/github/lib/utils'
import * as glob from '@actions/glob'
import * as io from '@actions/io'
import type {OctokitOptions, OctokitPlugin} from '@octokit/core/types'
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
export declare type AsyncFunctionArguments = {
context: Context
core: typeof core
github: InstanceType<typeof GitHub>
octokit: InstanceType<typeof GitHub>
getOctokit: (
token: string,
options?: OctokitOptions,
...additionalPlugins: OctokitPlugin[]
) => InstanceType<typeof GitHub>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
- Resolve integration.yml merge conflicts (user-agent assertions) - Fix OctokitOptions import path to @octokit/core/dist-types/types - Rebuild dist
The merge from main incorrectly used the v5 import path (@octokit/core/dist-types/types). v7 exports types via @octokit/core/types in its package.json exports map. Rebuild dist with correct dependency resolution.
| Back | FazBrowse Home | New Git URL |
What this does
Upgrades @actions/github to v9 (and related Octokit packages) and adds getOctokit to the script context.
Today, if you need a second Octokit client with a different token (GitHub App, PAT, cross-org), you do something like:
That breaks in v9 because @actions/github is now ESM-only — require() no longer works. This PR replaces that pattern with a built-in getOctokit that's available directly in the script context, no imports needed:
Works for GHES too:
The secondary client inherits retry settings, user-agent, proxy config, and plugins from the action — so it behaves consistently with the primary github client. request and retry options are deep-merged (so you can tweak one field without losing the rest), while other options like baseUrl or userAgent replace the default outright if you set them.
Dependency upgrades
Also updated tsconfig.json to ES2022 with bundler module resolution, and added Jest tsconfig overrides for CJS test compatibility.
Why v9
@actions/github v6 → v9 brings updated Octokit types and the orchestration ID user-agent feature (toolkit#2364). The main breaking change is that require('@actions/github') stops working inside scripts — workflows like MetaMask's that use this pattern will need to switch to the injected getOctokit instead.
Other breaking changes:
What's in the diff
New:
Changed:
Testing
Part of https://github.com/github/c2c-actions/issues/10001
Also closes: #707