Skip to content

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

Closed
angel-jiakou with Copilot wants to merge 5 commits into
mainfrom
copilot/upgrade-actions-github-and-octokit
Closed

Upgrade @actions/github to v9 and @octokit/core to v7+#708
angel-jiakou with Copilot wants to merge 5 commits into
mainfrom
copilot/upgrade-actions-github-and-octokit

Conversation

CopilotAI commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Upgrades @actions/github from v6 to v9 and @octokit/core from v5 to v7, which are ESM-only packages requiring TypeScript module resolution changes.

Dependency versions

PackageOldNew
@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

TypeScript config (tsconfig.json)

  • moduleResolution: "bundler" — required for ESM exports map resolution in @octokit/core v7 and @actions/github v9
  • module: "es2022" — required by bundler resolution
  • target: "es2022" — needed for ErrorOptions type used in @octokit/request-error
  • ts-jest configured with module: "commonjs" override to preserve CJS test execution

Import path fixes

  • src/retry-options.ts: @octokit/core/dist-types/types@octokit/core/types (v7 subpath export)
  • src/async-function.ts: @actions/github/lib/context is no longer in the v9 exports map. Replaced with typeof context derived from @actions/github/lib/utils:
// Beforeimport{Context}from'@actions/github/lib/context'import{GitHub}from'@actions/github/lib/utils'// ...
context: Context// Afterimport{contextas_ghContext,GitHub}from'@actions/github/lib/utils'// ...
context: typeof_ghContext

Build script

Updated build:types to pass --target es2022 --module es2022 --moduleResolution bundler since it specifies files directly (bypasses tsconfig.json).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- @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
- Update tsconfig.json to use moduleResolution: "bundler" for ESM exports map support
- Update import paths for new package structures
- Update build:types script for compatible compiler options
Co-authored-by: angel-jiakou <115738347+angel-jiakou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/actions/github-script/sessions/17de5ca1-8bdc-41e4-a06d-ab2d8c2e6e8c
CopilotAI changed the title [WIP] Upgrade @actions/github to v9 and @octokit/core to v7Upgrade @actions/github to v9 and @octokit/core to v7+Mar 23, 2026
CopilotAI requested a review from angel-jiakouMarch 23, 2026 20:29
CopilotAItemporarily deployed to debug-integration-test March 23, 2026 20:33 Inactive
@github-actions

github-actionsBot commented Mar 23, 2026

Copy link
Copy Markdown

Hello from actions/github-script! (2f6961d)

@angel-jiakou
angel-jiakoutemporarily deployed to debug-integration-test March 23, 2026 23:08 — with GitHub Actions Inactive
@angel-jiakou
angel-jiakoutemporarily deployed to debug-integration-test March 23, 2026 23:30 — with GitHub Actions Inactive
@angel-jiakou
angel-jiakou marked this pull request as ready for review March 23, 2026 23:33
@angel-jiakou
angel-jiakou requested a review from a team as a code ownerMarch 23, 2026 23:33
CopilotAI review requested due to automatic review settings March 23, 2026 23:33

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the Action’s GitHub/Octokit dependencies to ESM-only major versions and updates the TypeScript + test/build configuration and import paths to remain compatible.

Changes:

  • Upgrade @actions/github to v9 and @octokit/* dependencies to their v6/v7/v8 major versions.
  • Update TypeScript compilation settings for ESM (target/module es2022, moduleResolution: bundler) and adjust ts-jest to keep tests running in CJS.
  • Fix type/import paths impacted by the new packages’ exports maps and relax integration workflow user-agent assertions.

Reviewed changes

Copilot reviewed 28 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
types/async-function.d.tsUpdates exported argument types to avoid removed @actions/github/lib/context path.
tsconfig.jsonSwitches project TS target/module to ES2022 and module resolution to bundler.
src/retry-options.tsUpdates Octokit type import to the new v7 exported subpath.
src/async-function.tsAdjusts context typing approach to match @actions/github v9 export map changes.
package.jsonBumps deps, updates build:types, and adds ts-jest TS overrides.
package-lock.jsonLockfile updates for the new dependency graph and transitive packages.
.licenses/npm/wrappy.dep.ymlRemoves cached license entry (dependency no longer in licensed set).
.licenses/npm/universal-user-agent.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/undici-6.24.1.dep.ymlCorrects cached license metadata to match undici@6.24.1.
.licenses/npm/undici-5.28.5.dep.ymlAdds cached license metadata for undici@5.28.5.
.licenses/npm/once.dep.ymlRemoves cached license entry (dependency no longer in licensed set).
.licenses/npm/json-with-bigint.dep.ymlAdds cached license metadata for new transitive dependency.
.licenses/npm/fast-content-type-parse.dep.ymlAdds cached license metadata for new transitive dependency.
.licenses/npm/deprecation.dep.ymlRemoves cached license entry (dependency removed from graph).
.licenses/npm/before-after-hook.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/types.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/types-12.0.0.dep.ymlRemoves cached license entry for superseded version.
.licenses/npm/@octokit/request.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/request-error.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/plugin-retry.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/plugin-request-log.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/plugin-paginate-rest.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/openapi-types.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/openapi-types-19.0.0.dep.ymlRemoves cached license entry for superseded version.
.licenses/npm/@octokit/graphql.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/endpoint.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@octokit/core.dep.ymlUpdates cached license metadata version for direct dependency bump.
.licenses/npm/@octokit/auth-token.dep.ymlUpdates cached license metadata version for transitive bump.
.licenses/npm/@actions/http-client-3.0.2.dep.ymlAdds cached license metadata for new transitive version.
.licenses/npm/@actions/http-client-2.2.0.dep.ymlAdds cached license metadata for existing transitive version.
.licenses/npm/@actions/github.dep.ymlUpdates cached license metadata version for direct dependency bump.
.github/workflows/integration.ymlAdjusts user-agent integration assertions to allow the new user-agent format.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/async-function.ts Outdated
Comment on lines 3 to 4
import {context as _ghContext, GitHub} from '@actions/github/lib/utils'
import * as glob from '@actions/glob'

CopilotAIMar 23, 2026

Copy link

Choose a reason for hiding this comment

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

@actions/github/lib/utils is a deep import that isn’t part of the stable public API surface and has already changed once (lib/context disappeared in v9). Since this import is only used to derive types, prefer using public exports from @actions/github (e.g., typeof context for context and ReturnType<typeof getOctokit> for github/octokit) and make the import type-only so it can’t accidentally become a runtime dependency.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think this comment is valid so I'm gonna make these public exports in case this import changes again.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@danwkennedydanwkennedy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks fine so far but I'd upgrade all the Actions packages instead of just a few.

Comment threadpackage.json
@@ -40,12 +45,12 @@
"dependencies": {
"@actions/core": "^1.10.1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All the @actions/* packages have been upgraded, I would pick up those new versions as well.

@ericscipleericsciple left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hold — requires changes in main first to add a wrapper for getOctokit

salmanmkc added a commit that referenced this pull request Apr 9, 2026
Merges the @actions/github v9 upgrade branch into the createOctokit
feature branch, combining ADR steps 1 and 3 into a single major release.
Changes from v9 upgrade:
- @actions/github 6.x → 9.0.0 (ESM-only)
- @octokit/core v5→v7, plugin-request-log v4→v6, plugin-retry v6→v8
- tsconfig: moduleResolution bundler, module/target es2022
- ts-jest: module commonjs override for CJS test execution
- License file updates for new dependency versions
Conflict resolutions:
- src/async-function.ts: v9 import style + createOctokit type
- types/async-function.d.ts: aligned with .ts file
- integration.yml: v9 UA checks + createOctokit test job
- dist/index.js: rebuilt via ncc
Additional fix:
- getoctokit-integration.test.ts: use mock instead of direct
@actions/github import (ESM-only v9 incompatible with Jest CJS)
All 32 tests passing, TypeScript clean, lint clean.
@salmanmkc

Copy link
Copy Markdown
Contributor

Closing in favour of #700

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

8 participants

@salmanmkc@danwkennedy@ericsciple@angel-jiakou@hubot@angel-kou