-
Notifications
You must be signed in to change notification settings - Fork 164
List the versions that changed in package-version-bump PRs #8518
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
Merged
andrewlock
merged 2 commits into
master
from
andrew/add-summary-to-bump-package-versions
Apr 29, 2026
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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
81 changes: 0 additions & 81 deletions
81
tracer/build/_build/GeneratePackageVersions/CooldownReport.cs
This file was deleted.
Oops, something went wrong.
125 changes: 125 additions & 0 deletions
125
tracer/build/_build/GeneratePackageVersions/PackageBumpReport.cs
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| // <copyright file="PackageBumpReport.cs" company="Datadog"> | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. | ||
| // </copyright> | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace GeneratePackageVersions; | ||
|
|
||
| /// <summary> | ||
| /// Collects the outcome of a package version regeneration run (packages that were | ||
| /// bumped and packages that were skipped by the cooldown filter) and renders them | ||
| /// as a markdown report for inclusion in the PR body. | ||
| /// </summary> | ||
| public class PackageBumpReport | ||
| { | ||
| private readonly int _cooldownDays; | ||
| private readonly List<BumpEntry> _bumpedEntries = new(); | ||
| private readonly List<CooldownEntry> _cooldownEntries = new(); | ||
|
|
||
| public PackageBumpReport(int cooldownDays) | ||
| { | ||
| _cooldownDays = cooldownDays; | ||
| } | ||
|
|
||
| public bool HasEntries => _bumpedEntries.Count > 0 || _cooldownEntries.Count > 0; | ||
|
|
||
| public IReadOnlyList<BumpEntry> BumpedEntries => _bumpedEntries; | ||
|
|
||
| public IReadOnlyList<CooldownEntry> CooldownEntries => _cooldownEntries; | ||
|
|
||
| public void AddBump(BumpEntry entry) | ||
| { | ||
| _bumpedEntries.Add(entry); | ||
| } | ||
|
|
||
| public void AddCooldown(CooldownEntry entry) | ||
| { | ||
| _cooldownEntries.Add(entry); | ||
| } | ||
|
|
||
| public string ToMarkdown() | ||
| { | ||
| if (!HasEntries) | ||
| { | ||
| return string.Empty; | ||
| } | ||
|
|
||
| var sb = new StringBuilder(); | ||
|
|
||
| if (_bumpedEntries.Count > 0) | ||
| { | ||
| sb.AppendLine("## Package Version Updates"); | ||
| sb.AppendLine(); | ||
| sb.AppendLine("Bold entries indicate **major**-version bumps. `(new)` means no previous version existed."); | ||
| sb.AppendLine(); | ||
| sb.AppendLine("| Package | Integration | Previous | New | Published |"); | ||
| sb.AppendLine("|---------|-------------|----------|-----|-----------|"); | ||
|
|
||
| foreach (var entry in _bumpedEntries) | ||
| { | ||
| var previous = entry.PreviousVersion?.ToString() ?? "(new)"; | ||
| var newVersion = entry.IsMajorBump ? $"**{entry.NewVersion}**" : entry.NewVersion.ToString(); | ||
| var published = entry.PublishedDate?.UtcDateTime.ToString("yyyy-MM-dd") ?? "unknown"; | ||
|
|
||
| sb.AppendLine($"| {entry.PackageName} | {entry.IntegrationName} | {previous} | {newVersion} | {published} |"); | ||
| } | ||
|
|
||
| sb.AppendLine(); | ||
| } | ||
|
|
||
| if (_cooldownEntries.Count > 0) | ||
| { | ||
| sb.AppendLine("## Package Version Cooldown Report"); | ||
| sb.AppendLine(); | ||
| sb.AppendLine($"The following versions were published less than **{_cooldownDays} days** ago and have been overridden."); | ||
| sb.AppendLine("These require manual review before inclusion."); | ||
| sb.AppendLine(); | ||
| sb.AppendLine("| Package | Integration | Overridden Version | Published | Age (days) |"); | ||
| sb.AppendLine("|---------|-------------|--------------------|-----------|------------|"); | ||
|
|
||
| foreach (var entry in _cooldownEntries) | ||
| { | ||
| var published = entry.PublishedDate?.UtcDateTime.ToString("yyyy-MM-dd") ?? "unknown"; | ||
| var age = entry.PublishedDate.HasValue | ||
| ? ((int)(DateTimeOffset.UtcNow - entry.PublishedDate.Value).TotalDays).ToString() | ||
| : "?"; | ||
|
|
||
| sb.AppendLine($"| {entry.PackageName} | {entry.IntegrationName} | {entry.OverriddenVersion} | {published} | {age} |"); | ||
| } | ||
| } | ||
|
|
||
| return sb.ToString(); | ||
| } | ||
|
|
||
| public async Task SaveToFile(string path) | ||
| { | ||
| var markdown = ToMarkdown(); | ||
| if (!string.IsNullOrEmpty(markdown)) | ||
| { | ||
| // necessary to save to a file so that we can then output it in the PR description | ||
| await File.WriteAllTextAsync(path, markdown); | ||
| } | ||
| } | ||
|
|
||
| public record BumpEntry( | ||
| string PackageName, | ||
| string IntegrationName, | ||
| Version PreviousVersion, | ||
| Version NewVersion, | ||
| DateTimeOffset? PublishedDate) | ||
| { | ||
| public bool IsMajorBump => PreviousVersion is null || NewVersion.Major > PreviousVersion.Major; | ||
| } | ||
|
|
||
| public record CooldownEntry( | ||
| string PackageName, | ||
| string IntegrationName, | ||
| string OverriddenVersion, | ||
| DateTimeOffset? PublishedDate); | ||
| } |
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.