Skip to content

fix: reuse same PR for release notes workflow#3782

Merged
mattleibow merged 5 commits into
mainfrom
mattleibow/fix-release-notes-workflow-pr-reuse
Apr 28, 2026
Merged

fix: reuse same PR for release notes workflow#3782
mattleibow merged 5 commits into
mainfrom
mattleibow/fix-release-notes-workflow-pr-reuse

Conversation

@mattleibow

@mattleibow mattleibow commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves the "Update Upcoming Release Notes" agentic workflow and the generate-release-notes.py script with two changes: PR reuse and effort metrics.

PR Reuse

The workflow was creating a new PR on every run because the agent picked a unique branch name each time (e.g., dev/release-notes-4.147.0-b431d55e1660d280).

Fix: Added Step 6 instructing the agent to always use dev/upcoming-release-notes as the branch name. The create_pull_request safe-output detects the existing PR on that branch and updates it in place.

Effort Metrics

Each PR in the unreleased notes output now shows commit count and working days, giving a sense of effort and complexity:

- Variable font support by @ramezgerges (24 commits, 6 days) (skia: mono/skia#185)
- Quick typo fix by @contributor (1 commit, 1 day)

How it works

  1. SkiaSharp PR commits — fetched via gh pr view --json commits. All commits counted, unique calendar days collected.
  2. Companion skia PR detection — parses the PR body for mono/skia/pull/NNN links (patterns like "Companion Skia PR:", "Related skia PR:", or bare URLs).
  3. Skia PR effort via git log — uses git log on the externals/skia submodule with base_sha..head_sha range. Only counts commits by authors who also appear in the SkiaSharp PR (filtering out thousands of unrelated upstream Skia committers). The GitHub API caps at 100 commits per PR, so git log is the only reliable approach for large merge PRs (e.g., skia milestone bumps with 4000+ commits).

Example impact

PR Before After
#3702 Bump skia m147 87 commits, 8 days
#3560 Bump skia m132 44 commits, 12 days
#3703 Variable fonts 24 commits, 6 days
#3742 Color palettes 56 commits, 6 days

Changes

  • .github/workflows/update-release-notes.md — Added Step 6 for fixed branch name
  • .agents/skills/release-notes/scripts/generate-release-notes.py — Added effort metrics with companion skia PR support

Add Step 6 instructing the agent to always use branch name
'dev/upcoming-release-notes' so the create-pull-request safe-output
updates the existing PR instead of creating a new one each run.

Also adds cleanup for stale documentation PRs from previous runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 3782

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 3782"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-3782/packages --name skiasharp-pr-3782
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-3782

mattleibow and others added 4 commits April 28, 2026 05:38
Fetch commit data from each PR and compute:
- commitCount: total number of commits in the PR
- workingDays: number of unique calendar days with commits

Output format: '(3 commits, 2 days)' appended to each PR line,
giving a sense of effort/complexity for each change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The script now parses PR bodies for companion mono/skia PR references
(patterns like 'Companion Skia PR: https://github.com/mono/skia/pull/NNN')
and fetches those PRs' commit data. Only commits from authors who also
appear in the SkiaSharp PR are counted, filtering out unrelated upstream
Skia committers.

Also removes the 'close stale PRs' step from the agentic workflow to
avoid accidental closures — the fixed branch name alone ensures PR reuse.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The GitHub API silently caps PR commit lists at 100 (gh pr view) or
250 (REST). Large upstream merge PRs like skia milestone bumps have
thousands of commits, so the custom C API shim work at the end was
invisible to the API-only path.

Now checks the actual commit total from the REST API and falls back to
git log on the skia submodule when the API data is truncated. Filters
by author name (collected from SkiaSharp PR commits) to exclude
unrelated upstream Skia committers.

Example: m147 bump went from (59 commits, 3 days) to (87 commits, 8 days)
by correctly including Ramez's skia-side C API work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the API-first path and truncation detection logic. Always use
git log on the skia submodule — it's reliable regardless of PR size
and avoids extra API calls (gh pr view, gh api for commit count).

One API call per skia PR remains (for base/head SHAs), plus one
git fetch + git log. No functional change in output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow merged commit 4907dec into main Apr 28, 2026
2 of 4 checks passed
@mattleibow mattleibow deleted the mattleibow/fix-release-notes-workflow-pr-reuse branch April 28, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant