GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||
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
|
| 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.
@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.@actions/github imports (like @actions/github/lib/utils) may have changed paths.New:
src/create-configured-getoctokit.ts — factory wrapper (deep merge, undefined stripping, plugin dedup)Changed:
src/main.ts — wires factory into script contextsrc/async-function.ts — v9 type imports, getOctokit in argument typessrc/retry-options.ts — updated import path for v9tsconfig.json — ES2022 + bundler resolutionpackage.json — version 9.0.0, dependency bumps.github/workflows/integration.yml — new getOctokit test job, user-agent test fixREADME.md — v9 docs, getOctokit section with examples, breaking changes.licenses/ — refreshed for all upgraded packagesNote: 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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hello from actions/github-script! (fe5245d) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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:
getOctokit into the script execution context in src/main.ts.AsyncFunctionArguments TypeScript type to include getOctokit with an Octokit-typed signature.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
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
@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.
There was an error while loading. Please reload this page.
c7fb361 to
2fe016f
Compare
1bdc919 to
7f52c47
Compare
7f52c47 to
95933be
Compare
47f6d8e to
7ece71c
Compare
getOctokit in script context for multi-token workflowscreateOctokit to script context for multi-token workflows
createOctokit to script context for multi-token workflows
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
🤖 Automated AI Code Review SummaryRepository: ✅ No high-priority issues detected! Code looks good. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| version: 6.0.0 | ||
| type: npm | ||
| summary: GitHub API token authentication for browsers and Node.js | ||
| homepage: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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.
There was an error while loading. Please reload this page.
🤖 Automated AI Code Review SummaryRepository: 📋 Issues Identifiedℹ️ Low - Code maintainabilityFile: Issue: Missing homepage URL in dependency metadata Suggested Fix: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
🤖 Automated AI Code Review SummaryRepository: ✅ No high-priority issues detected! Code looks good. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Upgrade @actions/github to v9 and @octokit/core to v7+
There was an error while loading. Please reload this page.