Skip to content

Conversation

@ericstj
Copy link
Member

@ericstj ericstj commented Oct 22, 2025

This adds a workflow to run a script when a PR is labeled as needs-breaking-change-doc-created,

The script collects details about the PR, the breaking change issue template, and sample issues then asks an LLM to generate an issue based on that.

The issue content is then encoded into a clickable link which is then added as a comment to the PR.

I'm doing this from a dotnet branch so that I can hopefully create a PR off of it to demonstrate the workflow in action.

@ericstj ericstj requested review from a team and rzikm October 22, 2025 21:22
@ericstj ericstj requested a review from jeffhandley as a code owner October 22, 2025 21:22
Copilot AI review requested due to automatic review settings October 22, 2025 21:22
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 22, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an automated workflow for creating breaking change documentation. When a PR is labeled needs-breaking-change-doc-created, a PowerShell script analyzes the PR details and uses an LLM to generate documentation content. The generated content is then encoded into a clickable GitHub issue creation link, which is posted as a comment on the PR.

Key Changes

  • PowerShell script that collects PR data, analyzes it with LLM, and generates breaking change documentation
  • GitHub Actions workflow that triggers on label addition to run the automation
  • Configuration file for customizing LLM provider, repository settings, and other parameters

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
eng/breakingChanges/config.ps1 Configuration file defining LLM settings, GitHub repository paths, issue template settings, and rate limiting parameters
eng/breakingChanges/breaking-change-doc.ps1 Main PowerShell script implementing the breaking change documentation workflow with data collection, LLM analysis, and issue generation
eng/breakingChanges/README.md Documentation explaining the automation tool's features, setup instructions, usage examples, and configuration options
.github/workflows/breaking-change-doc.yml GitHub Actions workflow that triggers the script when a PR receives the needs-breaking-change-doc-created label

@ericstj
Copy link
Member Author

ericstj commented Oct 22, 2025

This is testing the workflow - #120988 Looks like it's failing to fetch the issues from dotnet/docs. I'll see if I can get it issue read permission to the docs repo.

@ericstj
Copy link
Member Author

ericstj commented Oct 22, 2025

Now seeing Error: unexpected response from the server: 403 Forbidden

Need to find out how to use models from a workflow.

Copy link
Member

@rzikm rzikm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I look forward to using this once the technical hurdles get ironed out.

@ericstj
Copy link
Member Author

ericstj commented Oct 23, 2025

This works file even without the workflow, so it can be used by directly running the script after installing the github CLI. Worse case we'll just use that and occasionally run it.

The summary of the problems with the workflow is that our workflows in the dotnet org don't have access to github models, and that's currently not a technical problem. I can unblock that by storing a secret in the repo as a token for another LLM provider, but I don't like storing/needing-to-update a secret.

@ericstj ericstj added area-Meta and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Oct 24, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

@ericstj
Copy link
Member Author

ericstj commented Oct 24, 2025

I don't expect this to work, but also trying copilot CLI provider.

@ericstj ericstj requested review from a team and removed request for a team October 29, 2025 00:31
@ericstj
Copy link
Member Author

ericstj commented Nov 6, 2025

@jeffhandley @dotnet/runtime-infrastructure can I get a review? If folks are worried about the workflow + secret used here I can remove that part and just keep the scripts, but I think the automation adds value.

The workflow will now run when a PR is closed, or a label is appled.

In both cases it only proceeds if the PR has both been merged and has the breaking change doc label.
@ericstj
Copy link
Member Author

ericstj commented Nov 8, 2025

it looks like the changes to URL escaping broke the formatting of newlines. I'll need to see when that happened and undo it.

@ericstj
Copy link
Member Author

ericstj commented Nov 8, 2025

I actually broke it when refactoring how we call the gh CLI. I also noticed some concern with passing prompts on the commandline. We should avoid this - instead passing a prompt as a file.

@ericstj ericstj requested a review from jeffhandley November 25, 2025 19:30
generate-breaking-change-doc:
if: |
github.repository_owner == 'dotnet' && (
(github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'needs-breaking-change-doc-created')) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice usage of github.event.pull_request.labels.*.name 💯


EXAMPLES:
.\breaking-change-doc.ps1 -PrNumber 114929 # Process specific PR
.\breaking-change-doc.ps1 -Query "repo:dotnet/runtime state:closed label:needs-breaking-change-doc-created is:merged merged:>2024-09-16 -milestone:11.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running in Query mode, the API call includes --repo $Config.SourceRepo. Is the repo:dotnet/runtime required to be part of the query as well?

Comment on lines +989 to +995
$closingIssuesInfo = if ($pr.ClosingIssues -and $pr.ClosingIssues.Count -gt 0) {
$issuesList = $pr.ClosingIssues | ForEach-Object {
$issueComments = if ($_.Comments -and $_.Comments.Count -gt 0) {
"Comments: $($_.Comments.Count) comments available"
} else {
"No comments"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We recently hit upon a gap in our processes where we can have both issues and PRs labeled as breaking-change Issue or PR that represents a breaking API or functional change over a previous release. , but we missed auditing breaking change issues to ensure all closing PRs for them were also labeled as breaking.

I don't think there's anything to do in this PR for that, but seeing the traversal of ClosingIssues here has me wondering if we should refine our approach for labeling--perhaps to automatically label merged PRs as breaking changes if a breaking-change issue was closed by the PR.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants