-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Grouped Updates #396
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cfab22f
Add dependency group metadata
Nishnha b3648a3
Use commit data to infer dependency groups instead of the PR body
Nishnha 9e8fb5b
Add tests for grouped updates
Nishnha b534cb5
FIXME: prevVersion and newVersion are blank for grouped updates
Nishnha b8e8f8c
Pull the group name from commit metadata
Nishnha 11c0ea4
build
Nishnha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ test('it returns the updated dependency information when there is a yaml fragmen | |
expect(updatedDependencies[0].alertState).toEqual('DISMISSED') | ||
expect(updatedDependencies[0].ghsaId).toEqual('GHSA-III-BBB') | ||
expect(updatedDependencies[0].cvss).toEqual(4.6) | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('it supports multiple dependencies within a single fragment', async () => { | ||
|
@@ -122,6 +123,8 @@ test('it supports multiple dependencies within a single fragment', async () => { | |
expect(updatedDependencies[0].alertState).toEqual('DISMISSED') | ||
expect(updatedDependencies[0].ghsaId).toEqual('GHSA-III-BBB') | ||
expect(updatedDependencies[0].cvss).toEqual(4.6) | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
|
||
expect(updatedDependencies[1].dependencyName).toEqual('coffeescript') | ||
expect(updatedDependencies[1].dependencyType).toEqual('indirect') | ||
|
@@ -135,6 +138,7 @@ test('it supports multiple dependencies within a single fragment', async () => { | |
expect(updatedDependencies[1].alertState).toEqual('') | ||
expect(updatedDependencies[1].ghsaId).toEqual('') | ||
expect(updatedDependencies[1].cvss).toEqual(0) | ||
expect(updatedDependencies[1].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('it returns the updated dependency information when there is a leading v in the commit message versions', async () => { | ||
|
@@ -170,6 +174,50 @@ test('it returns the updated dependency information when there is a leading v in | |
expect(updatedDependencies[0].alertState).toEqual('DISMISSED') | ||
expect(updatedDependencies[0].ghsaId).toEqual('GHSA-III-BBB') | ||
expect(updatedDependencies[0].cvss).toEqual(4.6) | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('it supports returning information about grouped updates', async () => { | ||
const commitMessage = | ||
'Bumps the docker group with 3 updates: [github.com/docker/cli](https://github.com/docker/cli), [github.com/docker/docker](https://github.com/docker/docker) and [github.com/moby/moby](https://github.com/moby/moby).\n' + | ||
'\n' + | ||
'Updates `github.com/docker/cli` from 24.0.1+incompatible to 24.0.2+incompatible\n' + | ||
'- [Commits](docker/[email protected])\n' + | ||
'\n' + | ||
'Updates `github.com/docker/docker` from 24.0.1+incompatible to 24.0.2+incompatible\n' + | ||
'- [Release notes](https://github.com/docker/docker/releases)\n' + | ||
'- [Commits](moby/[email protected])\n' + | ||
'\n' + | ||
'Updates `github.com/moby/moby` from 24.0.1+incompatible to 24.0.2+incompatible\n' + | ||
'- [Release notes](https://github.com/moby/moby/releases)\n' + | ||
'- [Commits](moby/[email protected])\n' + | ||
'\n' + | ||
'---\n' + | ||
'updated-dependencies:\n' + | ||
'- dependency-name: github.com/docker/cli\n' + | ||
' dependency-type: direct:production\n' + | ||
' update-type: version-update:semver-patch\n' + | ||
' dependency-group: docker\n' + | ||
'- dependency-name: github.com/docker/docker\n' + | ||
' dependency-type: direct:production\n' + | ||
' update-type: version-update:semver-patch\n' + | ||
' dependency-group: docker\n' + | ||
'- dependency-name: github.com/moby/moby\n' + | ||
' dependency-type: direct:production\n' + | ||
' update-type: version-update:semver-patch\n' + | ||
' dependency-group: docker\n' + | ||
'...\n' + | ||
'\n' + | ||
'Signed-off-by: dependabot[bot] <[email protected]>\n' | ||
|
||
const getAlert = async () => Promise.resolve({ alertState: 'DISMISSED', ghsaId: 'GHSA-III-BBB', cvss: 4.6 }) | ||
const getScore = async () => Promise.resolve(43) | ||
const updatedDependencies = await updateMetadata.parse(commitMessage, '', 'dependabot/docker/gh-base-image/docker-1234566789', 'main', getAlert, getScore) | ||
|
||
expect(updatedDependencies).toHaveLength(3) | ||
|
||
expect(updatedDependencies[0].dependencyName).toEqual('github.com/docker/cli') | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('docker') | ||
}) | ||
|
||
test('it only returns information within the first fragment if there are multiple yaml documents', async () => { | ||
|
@@ -211,6 +259,7 @@ test('it only returns information within the first fragment if there are multipl | |
expect(updatedDependencies[0].alertState).toEqual('') | ||
expect(updatedDependencies[0].ghsaId).toEqual('') | ||
expect(updatedDependencies[0].cvss).toEqual(0) | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('it properly handles dependencies which contain slashes', async () => { | ||
|
@@ -247,6 +296,7 @@ test('it properly handles dependencies which contain slashes', async () => { | |
expect(updatedDependencies[0].alertState).toEqual('') | ||
expect(updatedDependencies[0].ghsaId).toEqual('') | ||
expect(updatedDependencies[0].cvss).toEqual(0) | ||
expect(updatedDependencies[0].dependencyGroup).toEqual('') | ||
}) | ||
|
||
test('calculateUpdateType should handle all paths', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the README 👍🏻