Skip to content

feat: Parse versions from metadata links#632

Merged
truggeri merged 7 commits intodependabot:mainfrom
ppkarwasz:feat/multi-versions
Dec 22, 2025
Merged

feat: Parse versions from metadata links#632
truggeri merged 7 commits intodependabot:mainfrom
ppkarwasz:feat/multi-versions

Conversation

@ppkarwasz
Copy link
Contributor

@ppkarwasz ppkarwasz commented Jun 23, 2025

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 method 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:

  1. YAML metadata parsing Dependabot includes a YAML block in the commit message with structured details for each updated dependency:

    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 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 #402

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
@ppkarwasz ppkarwasz requested a review from a team as a code owner June 23, 2025 21:50
jeffwidman
jeffwidman previously approved these changes Jul 1, 2025
Copy link
Member

@jeffwidman jeffwidman left a 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

@ppkarwasz
Copy link
Contributor Author

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!

@tekumara
Copy link

tekumara commented Oct 6, 2025

Very much looking forward to this, thank you @ppkarwasz

@ppkarwasz ppkarwasz requested a review from jeffwidman October 6, 2025 07:22
ppkarwasz added a commit to ppkarwasz/infrastructure-actions that referenced this pull request Oct 26, 2025
…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.
@truggeri truggeri merged commit 7d590d1 into dependabot:main Dec 22, 2025
6 checks passed
@ppkarwasz ppkarwasz deleted the feat/multi-versions branch December 22, 2025 21:02
@ppkarwasz
Copy link
Contributor Author

Hi @truggeri,

Thank you very much for merging this. Any idea when will version 2.5.0 be released?

In the meantime, hope you have a great holiday season.

@truggeri
Copy link
Contributor

truggeri commented Jan 7, 2026

@ppkarwasz v2.5.0 was released yesterday.

@ppkarwasz
Copy link
Contributor Author

Hi @truggeri,

It looks like version 2.5.0 points to the parent commit (21025c7) of the merge commit for this PR (7d590d1), so the changes from this PR are not included in the release.

Just wanted to check whether this was intentional, or if I’m missing something on my end?

@truggeri
Copy link
Contributor

truggeri commented Jan 7, 2026

You're right, v2.5 didn't include this change. Intentional would be a bit strong 😕 , more of an oversight 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support newVersion and prevVersion for updates with multiple dependencies

5 participants