Skip to content

Commit 13d8274

Browse files
authored
Upgrade @actions/github to ^9.0.0 and @octokit/request-error to ^7.1.0 (#678)
Breaking changes addressed: - @actions/github 9.0.0: Package is now ESM-only. The ./lib/context subpath is no longer in the exports map, so a local github-context.ts shim derives the Context type and constructor from the context singleton. - @octokit/request-error 7.x: Removed headers from RequestErrorOptions. Updated test constructor call accordingly. - @octokit/request-error bumped to ^7.1.0 to align with the version used transitively by @actions/github 9.x (prevents instanceof mismatches).
1 parent b603099 commit 13d8274

9 files changed

Lines changed: 5414 additions & 22409 deletions

File tree

dist/index.js

Lines changed: 5197 additions & 22132 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 203 additions & 270 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"license": "MIT",
2525
"dependencies": {
2626
"@actions/core": "^3.0.0",
27-
"@actions/github": "^6.0.1",
28-
"@octokit/request-error": "^5.1.1",
27+
"@actions/github": "^9.0.0",
28+
"@octokit/request-error": "^7.1.0",
2929
"pluralize": "^8.0.0"
3030
},
3131
"devDependencies": {

src/dependabot/github-context.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as github from '@actions/github'
2+
3+
// Re-export the Context type derived from the context singleton.
4+
// @actions/github v9 does not export the Context class directly from its exports map.
5+
export type Context = typeof github.context
6+
7+
// The Context constructor (used in dry-run and tests to create fresh instances)
8+
export const Context = github.context.constructor as new () => Context

src/dependabot/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Context } from '@actions/github/lib/context'
1+
import type { Context } from './github-context'
22

33
export function parseNwo (nwo: string): {owner: string; repo: string} {
44
const [owner, name] = nwo.split('/')

src/dependabot/verified_commits.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as github from '@actions/github'
22
import * as core from '@actions/core'
33
import nock from 'nock'
4-
import { Context } from '@actions/github/lib/context'
4+
import { Context } from './github-context'
55
import { getAlert, getMessage, trimSlashes, getCompatibility } from './verified_commits'
66

77
beforeAll(() => {

src/dependabot/verified_commits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as core from '@actions/core'
22
import { GitHub } from '@actions/github/lib/utils'
3-
import { Context } from '@actions/github/lib/context'
3+
import type { Context } from './github-context'
44
import type { dependencyAlert } from './update_metadata'
55
import https from 'https'
66

src/dry-run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import * as github from '@actions/github'
3-
import { Context } from '@actions/github/lib/context'
3+
import { Context } from './dependabot/github-context'
44
import * as dotenv from 'dotenv'
55
import { Argv } from 'yargs'
66
import { hideBin } from 'yargs/helpers'

src/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ test('it sets the action to failed if there is a request error', async () => {
522522
jest.spyOn(util, 'getBranchNames').mockReturnValue({ headName: 'dependabot|nuget|feature1', baseName: 'main' })
523523
jest.spyOn(dependabotCommits, 'getMessage').mockImplementation(jest.fn(
524524
() => Promise.reject(new RequestError('Something bad happened!', 500, {
525-
headers: {},
526525
request: {
527526
method: 'GET',
528527
url: 'https://api.github.com/repos/dependabot/dependabot/pulls/101/commits',

0 commit comments

Comments
 (0)