Skip to content

Commit 26e18ca

Browse files
authored
Merge branch 'main' into patch-1
2 parents 0caf82f + a30bbbb commit 26e18ca

File tree

4 files changed

+17
-52
lines changed

4 files changed

+17
-52
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Extract information about the dependencies being updated by a Dependabot-generat
1010

1111
## Usage instructions
1212

13-
Create a workflow file that contains a step that uses: `dependabot/fetch-metadata@v1.1.1`, e.g.
13+
Create a workflow file that contains a step that uses: `dependabot/fetch-metadata@v1.2.1`, e.g.
1414

1515
```yaml
1616
-- .github/workflows/dependabot-prs.yml
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- name: Fetch Dependabot metadata
2424
id: dependabot-metadata
25-
uses: dependabot/fetch-metadata@v1.1.1
25+
uses: dependabot/fetch-metadata@v1.2.1
2626
with:
2727
alert-lookup: true
2828
```
@@ -87,7 +87,7 @@ jobs:
8787
steps:
8888
- name: Dependabot metadata
8989
id: dependabot-metadata
90-
uses: dependabot/fetch-metadata@v1.1.1
90+
uses: dependabot/fetch-metadata@v1.2.1
9191
- name: Approve a PR
9292
run: gh pr review --approve "$PR_URL"
9393
env:
@@ -115,7 +115,7 @@ jobs:
115115
steps:
116116
- name: Dependabot metadata
117117
id: dependabot-metadata
118-
uses: dependabot/fetch-metadata@v1.1.1
118+
uses: dependabot/fetch-metadata@v1.2.1
119119
- name: Enable auto-merge for Dependabot PRs
120120
if: ${{contains(steps.dependabot-metadata.outputs.dependency-names, 'rails') && steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch'}}
121121
run: gh pr merge --auto --merge "$PR_URL"
@@ -144,7 +144,7 @@ jobs:
144144
steps:
145145
- name: Dependabot metadata
146146
id: dependabot-metadata
147-
uses: dependabot/fetch-metadata@v1.1.1
147+
uses: dependabot/fetch-metadata@v1.2.1
148148
- name: Add a label for all production dependencies
149149
if: ${{ steps.dependabot-metadata.outputs.dependency-type == 'direct:production' }}
150150
run: gh pr edit "$PR_URL" --add-label "production"

dist/index.js

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

src/dependabot/verified_commits.test.ts

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,6 @@ test('it returns false for an event triggered by someone other than Dependabot',
3333
)
3434
})
3535

36-
test('it returns false if there is more than 1 commit', async () => {
37-
nock('https://api.github.com').get('/repos/dependabot/dependabot/pulls/101/commits')
38-
.reply(200, [
39-
{
40-
commit: {
41-
message: 'Bump lodash from 1.0.0 to 2.0.0'
42-
}
43-
},
44-
{
45-
commit: {
46-
message: 'Add some more things.'
47-
}
48-
}
49-
])
50-
51-
expect(await getMessage(mockGitHubClient, mockGitHubPullContext())).toBe(false)
52-
53-
expect(core.warning).toHaveBeenCalledWith(
54-
expect.stringContaining("It looks like this PR has contains commits that aren't part of a Dependabot update.")
55-
)
56-
})
57-
5836
test('it returns false if the commit was authored by someone other than Dependabot', async () => {
5937
nock('https://api.github.com').get('/repos/dependabot/dependabot/pulls/101/commits')
6038
.reply(200, [
@@ -71,7 +49,7 @@ test('it returns false if the commit was authored by someone other than Dependab
7149
expect(await getMessage(mockGitHubClient, mockGitHubPullContext())).toBe(false)
7250

7351
expect(core.warning).toHaveBeenCalledWith(
74-
expect.stringContaining("It looks like this PR has contains commits that aren't part of a Dependabot update.")
52+
expect.stringContaining('It looks like this PR was not created by Dependabot, refusing to proceed.')
7553
)
7654
})
7755

@@ -124,6 +102,11 @@ test('it returns the commit message for a PR authored exclusively by Dependabot
124102
verified: true
125103
}
126104
}
105+
},
106+
{
107+
commit: {
108+
message: 'Add some more things.'
109+
}
127110
}
128111
])
129112

src/dependabot/verified_commits.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ export async function getMessage (client: InstanceType<typeof GitHub>, context:
3232
pull_number: pr.number
3333
})
3434

35-
if (commits.length > 1) {
36-
warnOtherCommits()
37-
return false
38-
}
39-
4035
const { commit, author } = commits[0]
4136

4237
if (author?.login !== DEPENDABOT_LOGIN) {
43-
warnOtherCommits()
38+
// TODO: Promote to setFailed
39+
core.warning(
40+
'It looks like this PR was not created by Dependabot, refusing to proceed.'
41+
)
4442
return false
4543
}
4644

@@ -55,14 +53,6 @@ export async function getMessage (client: InstanceType<typeof GitHub>, context:
5553
return commit.message
5654
}
5755

58-
function warnOtherCommits (): void {
59-
core.warning(
60-
"It looks like this PR has contains commits that aren't part of a Dependabot update. " +
61-
"Try using '@dependabot rebase' to remove merge commits or '@dependabot recreate' to remove " +
62-
'any non-Dependabot changes.'
63-
)
64-
}
65-
6656
export async function getAlert (name: string, version: string, directory: string, client: InstanceType<typeof GitHub>, context: Context): Promise<dependencyAlert> {
6757
const alerts: any = await client.graphql(`
6858
{

0 commit comments

Comments
 (0)