-
Notifications
You must be signed in to change notification settings - Fork 100
feat: Parse versions from metadata links #632
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
base: main
Are you sure you want to change the base?
Conversation
Dependabot PRs that update a **single** dependency include version details in the commit message introduction, e.g., > "Bumps `<dependency>` from `<prevVersion>` to `<newVersion>`" This is the format generated by the [`commit_message_intro`](https://github.com/dependabot/dependabot-core/blob/cc4b4eaade37da0a19e0897e6897bab613064e74/common/lib/dependabot/pull_request_creator/message_builder.rb#L320-L325) method in Dependabot Core. However, when **multiple dependencies** are updated in a single PR, this format isn't used consistently, which limits the action’s ability to extract accurate version information. This change improves version parsing for multi-dependency PRs by introducing two additional detection strategies: 1. **YAML metadata parsing** Dependabot includes a YAML block in the commit message with structured details for each updated dependency: ```yaml updated-dependencies: - dependency-name: commons-codec:commons-codec dependency-version: 1.18.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: non-breaking ``` This is the most reliable and stable source for the **new** version of each dependency, though it does **not** include the previous version. 2. **Metadata links parsing** In multi-dependency updates, Dependabot also appends “metadata links” with a format like: > "Updates `<dependencyName>` from `<prevVersion>` to `<newVersion>`" These lines are generated bythe [`metadata_links`](https://github.com/dependabot/dependabot-core/blob/cc4b4eaade37da0a19e0897e6897bab613064e74/common/lib/dependabot/pull_request_creator/message_builder.rb#L664-L678) method and provide **both** the old and new versions. By combining these sources, the action now supports version parsing for PRs with multiple updated dependencies—broadening its coverage and improving reliability. Closes dependabot#402
jeffwidman
left a comment
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.
This looks good to me, other than not understanding the comment syntax?
I'd appreciate if @JamieMagee took a quick look as well since he worked on exposing some of this metadata as he may be aware of some additional context
|
Hi @jeffwidman, Just a gentle reminder about this PR. Since we switched to compulsory reviews, handling Dependabot PRs (which previously merged automatically with changelog entries) has become more time-consuming. This change (along with apache/logging-parent#419) is part of the approach we devised to streamline things by grouping updates and reviewing them as a single PR. Would you have an idea when this might be merged and included in a release? Thanks! |
|
Very much looking forward to this, thank you @ppkarwasz |
| * See `Dependabot::PullRequestCreator::MessageBuilder#metadata_links` in the Ruby codebase for more details | ||
| * on the current format. | ||
| * | ||
| * **NOTE**: This data is only available if more than one dependency is updated in a single PR. |
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.
fyi, here's an example of a grouped update with 1 update - i think this would match here (contrary to the comment)?
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.
You are right grouped PRs with a single updated dependency also contain this data, so I should amend the comment.
The exact generating logic is here.
…etadata` This PR allows the usage of the `ppkarwasz/fetch-metadata` GitHub Action as an alternative to `dependabot/fetch-metadata` in ASF repositories. The `ppkarwasz/fetch-metadata` action is a personal improvement of the original `dependabot/fetch-metadata`, adding support for grouped Dependabot pull requests, a feature that is currently missing from the upstream action. The implementation has already been reviewed and approved by the Dependabot team (see dependabot/fetch-metadata#632), but the upstream project has been inactive for several months, likely due to reduced maintenance capacity at GitHub. This has prevented the improvement from being merged and released. ### Why this change is needed In Apache Logging Services, every pull request must include a changelog entry. Previously, under CTR, we used a workflow that automatically added the changelog entry and merged the PR. Since switching to RTC, this automation can no longer complete the merge step, resulting in repositories accumulating unmerged Dependabot PRs that must be: * manually reviewed, * updated with an empty commit to re-trigger required status checks, * and merged by hand. We already have an improved workflow in place (see apache/logging-parent#419) that provides: * **Security enhancements** through separation of privileged and unprivileged workflows (`ppkarwasz/fetch-metadata` is used only in the unprivileged workflow), * **Automatic merge using `auto-merge` instead of manual merging**, and * **Support for grouped Dependabot PRs** (reducing noise to ~1 PR per repository per month). The final item, grouped PR support, requires the `ppkarwasz/fetch-metadata` action.
Dependabot PRs that update a single dependency include version details in the commit message introduction, e.g.,
This is the format generated by the
commit_message_intromethod in Dependabot Core.However, when multiple dependencies are updated in a single PR, this format isn't used, which limits the action’s ability to extract accurate version information.
This change improves version parsing for multi-dependency PRs by introducing two additional detection strategies:
YAML metadata parsing Dependabot includes a YAML block in the commit message with structured details for each updated dependency:
This is the most reliable and stable source for the new version of each dependency, though it does not include the previous version.
Metadata links parsing In multi-dependency updates, Dependabot also appends “metadata links” with a format like:
These lines are generated bythe
metadata_linksmethod and provide both the old and new versions.By combining these sources, the action now supports version parsing for PRs with multiple updated dependencies—broadening its coverage and improving reliability.
Closes #402