GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat!: add getOctokit to script context, upgrade @actions/github v9, @octokit/core v7, and related packages by salmanmkc · Pull Request #700 · actions/github-script

Conversation

@salmanmkc

@salmanmkc salmanmkc commented Mar 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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:

const { getOctokit } = require('@actions/github')
const appClient = getOctokit(process.env.APP_TOKEN)

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:

- uses: actions/github-script@v9
  env:
    APP_TOKEN: ${{ secrets.MY_APP_TOKEN }}
  with:
    script: |
      // primary client uses GITHUB_TOKEN as usual
      await github.rest.issues.addLabels({
        issue_number: context.issue.number,
        owner: context.repo.owner,
        repo: context.repo.repo,
        labels: ['needs-review']
      })

      // secondary client uses a different token
      const appOctokit = getOctokit(process.env.APP_TOKEN)
      await appOctokit.rest.repos.createDispatchEvent({
        owner: 'my-org', repo: 'deploy', event_type: 'go'
      })

Works for GHES too:

const ghes = getOctokit(process.env.GHES_TOKEN, {
  baseUrl: 'https://github.example.com/api/v3'
})

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

Package Old New
@actions/github ^6.0.0 ^9.0.0
@octokit/core ^5.0.1 ^7.0.0
@octokit/plugin-request-log ^4.0.0 ^6.0.0
@octokit/plugin-retry ^6.0.1 ^8.0.0
Package version 7.0.1 9.0.0

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:

  • const getOctokit = ... or let getOctokit = ... in scripts will SyntaxError (same as const github = ... today — function parameters can't be redeclared with const/let). Use it directly or use var if you really need to redeclare.
  • Internal @actions/github imports (like @actions/github/lib/utils) may have changed paths.

What's in the diff

New:

  • src/create-configured-getoctokit.ts — factory wrapper (deep merge, undefined stripping, plugin dedup)
  • Tests: 16 factory unit tests, 4 integration tests, CI workflow job with real API calls

Changed:

  • src/main.ts — wires factory into script context
  • src/async-function.ts — v9 type imports, getOctokit in argument types
  • src/retry-options.ts — updated import path for v9
  • tsconfig.json — ES2022 + bundler resolution
  • package.json — version 9.0.0, dependency bumps
  • .github/workflows/integration.yml — new getOctokit test job, user-agent test fix
  • README.md — v9 docs, getOctokit section with examples, breaking changes
  • .licenses/ — refreshed for all upgraded packages

Testing

  • 35 tests across 4 suites, all green
  • 15/15 CI checks passing
  • Live demo — real multi-token workflow reading a private repo via SECOND_PAT, GraphQL queries, cross-identity verification

Note: This PR also includes release prep (version bump to 9.0.0, README examples updated to @v9, V9 breaking changes section, license cache refresh). This can be split into a separate PR if preferred.

Part of https://github.com/github/c2c-actions/issues/10001
Also closes: #707

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings March 1, 2026 00:26
@salmanmkc
salmanmkc requested a review from a team as a code owner March 1, 2026 00:26
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test March 1, 2026 00:26 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Mar 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Hello from actions/github-script! (fe5245d)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of salmanmkc March 1, 2026 00:26
View session
Copilot AI reviewed Mar 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

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:

  • Passes getOctokit into the script execution context in src/main.ts.
  • Extends the AsyncFunctionArguments TypeScript type to include getOctokit with an Octokit-typed signature.

Reviewed 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.
Comments suppressed due to low confidence (2)

src/main.ts:71

  • getOctokit is being passed through directly from @actions/github, so any Octokit clients created inside the user script won’t automatically inherit this action’s configured defaults (e.g., base-url for GHES, user-agent with orchestration ID, retries/request options, and the installed retry/requestLog plugins). This can lead to surprising differences between github and getOctokit(...) behavior. Consider exposing a wrapper that pre-applies the same options/plugins by default (while still allowing callers to override/extend options/plugins when needed).
      github,
      octokit: github,
      getOctokit,
      context,
      core,

src/async-function.ts:20

  • This adds a new deep import from @octokit/core/types, but the codebase already imports Octokit types via @octokit/core/dist-types/types (e.g. src/retry-options.ts). To stay consistent (and to reduce the risk of relying on a non-exported subpath), align the import path with the existing convention or derive the type directly from @actions/github (e.g., type getOctokit as typeof import('@actions/github').getOctokit) so the signature can’t drift from the actual implementation.
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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test March 1, 2026 01:30 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test March 9, 2026 11:47 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test March 9, 2026 11:52 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test March 9, 2026 12:02 — with GitHub Actions Inactive
pelikhan
pelikhan approved these changes Mar 9, 2026
View reviewed changes
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 7, 2026 15:47 — with GitHub Actions Inactive
@salmanmkc
salmanmkc force-pushed the salmanmkc/expose-getoctokit branch from c7fb361 to 2fe016f Compare April 7, 2026 15:50
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 7, 2026 15:50 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 7, 2026 16:08 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 20:41 — with GitHub Actions Inactive
@salmanmkc
salmanmkc force-pushed the salmanmkc/expose-getoctokit branch from 1bdc919 to 7f52c47 Compare April 8, 2026 20:44
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 20:44 — with GitHub Actions Inactive
@salmanmkc
salmanmkc force-pushed the salmanmkc/expose-getoctokit branch from 7f52c47 to 95933be Compare April 8, 2026 20:48
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 20:48 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 21:39 — with GitHub Actions Inactive
@salmanmkc
salmanmkc force-pushed the salmanmkc/expose-getoctokit branch from 47f6d8e to 7ece71c Compare April 8, 2026 21:41
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 21:41 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 8, 2026 21:46 — with GitHub Actions Inactive
@salmanmkc salmanmkc changed the title feat: expose getOctokit in script context for multi-token workflows feat: add createOctokit to script context for multi-token workflows Apr 8, 2026
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 9, 2026 08:00 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 9, 2026 08:55 — with GitHub Actions Inactive
@salmanmkc salmanmkc changed the title feat: add createOctokit to script context for multi-token workflows feat!: expose getOctokit in script context and upgrade to @actions/github v9 Apr 9, 2026
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 9, 2026 09:03 — with GitHub Actions Inactive
@salmanmkc
salmanmkc temporarily deployed to debug-integration-test April 9, 2026 09:10 — with GitHub Actions Inactive
ericsciple
ericsciple approved these changes Apr 9, 2026
View reviewed changes
sneha-krip
sneha-krip approved these changes Apr 9, 2026
View reviewed changes
Comment thread package.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

@salmanmkc
salmanmkc merged commit 3a2844b into main Apr 9, 2026
15 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@salmanmkc
salmanmkc deleted the salmanmkc/expose-getoctokit branch April 9, 2026 22:39
@salmanmkc salmanmkc mentioned this pull request Apr 10, 2026
Upgrade @actions/github to v9 and @octokit/core to v7+ #708
Closed
This was referenced Apr 10, 2026
Bump actions/github-script from 8 to 9 senzing-factory/build-resources#289
Merged
Bump actions/github-script from 8 to 9 labrynx/auto_comments#34
Merged
chore(deps): update actions/github-script action to v9 lacolaco/blog.lacolaco.net#1501
Merged
@YumNumm YumNumm mentioned this pull request May 11, 2026
[Improve]: actions/github-script を v7.0.1 から v9.0.0 にアップデートする ymm-oss/flutter-mobile-project-template#630
Closed
3 tasks
This was referenced May 15, 2026
ci(deps): bump actions/github-script from 7.1.0 to 9.0.0 CopilotKit/skills#8
Merged
ci(deps): bump actions/github-script from 7.1.0 to 9.0.0 CopilotKit/outpost#45
Merged
ci(deps): bump actions/github-script from 7.1.0 to 9.0.0 CopilotKit/vscode-extension#47
Merged
ci(deps): bump actions/github-script from 7.1.0 to 9.0.0 CopilotKit/aimock#204
Merged
chore(ci)(deps): bump actions/github-script from 7.1.0 to 9.0.0 CopilotKit/CopilotKit#4892
Closed
chore(ci)(deps): bump actions/github-script from 7.1.0 to 9.0.0 ag-ui-protocol/ag-ui#1713
Closed
@jtbandes jtbandes mentioned this pull request Jun 18, 2026
Upgrade @actions/github to ^6.0.1 #686
Closed
This was referenced Jun 20, 2026
ci: allow Claude PR creation workflows keito4/extensions#121
Merged
feat: opt-in coverage comment in the CI pipeline yonatankarp/github-actions#140
Merged
This was referenced Jul 14, 2026
fix(fleet-monitor): auto-close resolved fleet-tracker issues + stop daily-digest accumulation (#1203) combsmith/.github-private#1204
Merged
feat: add Git repository check and automatic .gitignore append safety TestSprite/testsprite-cli#257
Merged
This was referenced Jul 23, 2026
Modernize lint/format tooling (mise + swift-format) and refresh CI/dependencies brightdigit/TransistorPublishPlugin#6
Merged
Sync subrepo branch brightdigit-com-260717 brightdigit/ContributeMailchimp#1
Merged
ci: redesign CI authorization and build pipeline for master openshift-service-mesh/proxy#323
Merged
@github-actions github-actions Bot mentioned this pull request Aug 20, 2026
[WR] A stale issue:done label permanently blocks a WR from ever being retried midnghtsapphire/revvel-standards#17750
Closed
4 tasks
@michael-sterling michael-sterling mentioned this pull request Sep 4, 2026
[BUG]: 304 "Not Modified" Conditional Responses are Logged as Errors octokit/plugin-request-log.js#466
Open
1 task done
@WadekarAsha

WadekarAsha commented Sep 18, 2026

Copy link
Copy Markdown

🤖 Automated AI Code Review Summary

Repository: actions/github-script | PR: #700 | Total Issues: 0

✅ No high-priority issues detected! Code looks good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

WadekarAsha
WadekarAsha reviewed Sep 21, 2026
View reviewed changes
Comment thread .licenses/npm/@octokit/auth-token.dep.yml
version: 6.0.0
type: npm
summary: GitHub API token authentication for browsers and Node.js
homepage:

@WadekarAsha WadekarAsha Sep 21, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Low - Code maintainability

File: .licenses/npm/@octokit/auth-token.dep.yml | Line: 6

Issue: Missing homepage URL in dependency metadata

Suggested Fix:

homepage: https://github.com/octokit/auth-token.js

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@WadekarAsha

WadekarAsha commented Sep 21, 2026

Copy link
Copy Markdown

🤖 Automated AI Code Review Summary

Repository: actions/github-script | PR: #700 | Total Issues: 1

📋 Issues Identified

ℹ️ Low - Code maintainability

File: .licenses/npm/@octokit/auth-token.dep.yml | Line: 6

Issue: Missing homepage URL in dependency metadata

Suggested Fix:

homepage: https://github.com/octokit/auth-token.js

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@WadekarAsha

WadekarAsha commented Sep 21, 2026

Copy link
Copy Markdown

🤖 Automated AI Code Review Summary

Repository: actions/github-script | PR: #700 | Total Issues: 0

✅ No high-priority issues detected! Code looks good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Sep 22, 2026
Enable prioritized stacked PR previews benhook1013/FireMUD#2835
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@ericsciple ericsciple ericsciple approved these changes
@sneha-krip sneha-krip sneha-krip approved these changes
+2 more reviewers
@WadekarAsha WadekarAsha WadekarAsha left review comments
@pelikhan pelikhan pelikhan approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Upgrade @actions/github to v9 and @octokit/core to v7+

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@salmanmkc @WadekarAsha @pelikhan @ericsciple @sneha-krip
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.