fix: reuse same PR for release notes workflow#3782
Merged
Conversation
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>
Contributor
📦 Try the packages from this PRWarning 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 -- 3782PowerShell / 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-3782More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-3782 |
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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Improves the "Update Upcoming Release Notes" agentic workflow and the
generate-release-notes.pyscript 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-notesas the branch name. Thecreate_pull_requestsafe-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:
How it works
gh pr view --json commits. All commits counted, unique calendar days collected.mono/skia/pull/NNNlinks (patterns like "Companion Skia PR:", "Related skia PR:", or bare URLs).git logon theexternals/skiasubmodule withbase_sha..head_sharange. 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
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