Skip to content

Commit 29dc6db

Browse files
committed
getMessage can skip commit verification checks
1 parent bfac3fa commit 29dc6db

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/dependabot/verified_commits.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ test('it returns false if the commit is has no verification payload', async () =
7070
expect(await getMessage(mockGitHubClient, mockGitHubPullContext())).toBe(false)
7171
})
7272

73+
test('it returns the message if the commit is has no verification payload but verification is skipped', async () => {
74+
nock('https://api.github.com').get('/repos/dependabot/dependabot/pulls/101/commits')
75+
.reply(200, [
76+
{
77+
author: {
78+
login: 'dependabot[bot]'
79+
},
80+
commit: {
81+
message: 'Bump lodash from 1.0.0 to 2.0.0',
82+
verification: null
83+
}
84+
}
85+
])
86+
87+
expect(await getMessage(mockGitHubClient, mockGitHubPullContext(), true)).toEqual('Bump lodash from 1.0.0 to 2.0.0')
88+
})
89+
7390
test('it returns false if the commit is not verified', async () => {
7491
nock('https://api.github.com').get('/repos/dependabot/dependabot/pulls/101/commits')
7592
.reply(200, [

src/dependabot/verified_commits.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import https from 'https'
66

77
const DEPENDABOT_LOGIN = 'dependabot[bot]'
88

9-
export async function getMessage (client: InstanceType<typeof GitHub>, context: Context): Promise<string | false> {
9+
export async function getMessage (client: InstanceType<typeof GitHub>, context: Context, skipCommitVerification = false): Promise<string | false> {
1010
core.debug('Verifying the job is for an authentic Dependabot Pull Request')
1111

1212
const { pull_request: pr } = context.payload
@@ -43,7 +43,7 @@ export async function getMessage (client: InstanceType<typeof GitHub>, context:
4343
return false
4444
}
4545

46-
if (!commit.verification?.verified) {
46+
if (!skipCommitVerification && !commit.verification?.verified) {
4747
// TODO: Promote to setFailed
4848
core.warning(
4949
"Dependabot's commit signature is not verified, refusing to proceed."

0 commit comments

Comments
 (0)