Skip to content

feat: Parse versions from metadata links#632

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

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

Conversation

@ppkarwasz

@ppkarwasz ppkarwasz commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

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

@jeffwidman jeffwidman left a comment

Copy link
Copy Markdown
Member

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

Comment thread src/dependabot/update_metadata.ts Outdated
@ppkarwasz

Copy link
Copy Markdown
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

tekumara commented Oct 6, 2025

Copy link
Copy Markdown

Very much looking forward to this, thank you @ppkarwasz

@ppkarwasz ppkarwasz requested a review from jeffwidman October 6, 2025 07:22
Comment thread dist/index.js
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.
Comment thread src/dependabot/update_metadata.ts
@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
Copy Markdown
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

truggeri commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

@ppkarwasz v2.5.0 was released yesterday.

@ppkarwasz

Copy link
Copy Markdown
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

truggeri commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

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

cmeans-claude-dev Bot added a commit to cmeans/mcp-synology that referenced this pull request Apr 26, 2026
Closes the auto-CHANGELOG empty-versions bug surfaced by live
Dependabot PR #59.

Root cause: dependabot/fetch-metadata@v2.5.0 returns empty-string
prevVersion / newVersion for every package in a grouped update.
The workflow's inline Python used d.get('prevVersion', '?'), which
only falls back on missing keys — empty strings render as nothing.

Upstream PR dependabot/fetch-metadata#632 (shipped v3.0.0, refined
v3.1.0) added body-metadata parsing for multi-dependency PRs, so
the durable fix is just the SHA bump:

  dependabot/fetch-metadata
    21025c705c08248db411dc16f3619e6b5f9ea21a (v2.5.0)
    → 25dd0e34f4fe68f24cc83900b1fe3fe149efef98 (v3.1.0)

No inline-Python changes needed. v3 also requires Node.js 24 as
the Actions runtime, clearing the Node.js-20 deprecation warning
the v2 line was emitting on every run.

Verification gate (per don't-propagate-unverified-fixes rule):
1. ✅ Land this fix on main
2. @dependabot recreate PR #59
3. Confirm the recreated PR's CHANGELOG entry reads correctly
4. ONLY THEN consider cascading the broader Dependabot-PR-hygiene
   work + the doubled-prefix fix from #57 to
   cmeans/pypi-winnow-downloads

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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