Add GitHub Action to suggest version branches for PRs#2444
Conversation
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||
761f168 to
dc14163
Compare
| const comment = `### Branch Targeting Suggestion | ||
|
|
||
| You've targeted the \`master\` branch with this PR. Please consider if a version branch might be more appropriate: | ||
|
|
||
| - **\`maintenance-9.x\`** - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release. | ||
|
|
||
| - **\`maintenance-10.x\`** - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x | ||
|
|
||
| If \`master\` is the correct target for this change, no action is needed. | ||
|
|
||
| --- | ||
| *This is an automated suggestion to help route contributions to the appropriate branch.*`; | ||
|
|
||
| github.rest.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: comment | ||
| }); |
There was a problem hiding this comment.
Suggestion: Prevent posting duplicate comments
| const comment = `### Branch Targeting Suggestion | |
| You've targeted the \`master\` branch with this PR. Please consider if a version branch might be more appropriate: | |
| - **\`maintenance-9.x\`** - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release. | |
| - **\`maintenance-10.x\`** - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x | |
| If \`master\` is the correct target for this change, no action is needed. | |
| --- | |
| *This is an automated suggestion to help route contributions to the appropriate branch.*`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: comment | |
| }); | |
| const body = `### Branch Targeting Suggestion | |
| You've targeted the \`master\` branch with this PR. Please consider if a version branch might be more appropriate: | |
| - **\`maintenance-9.x\`** - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release. | |
| - **\`maintenance-10.x\`** - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x | |
| If \`master\` is the correct target for this change, no action is needed. | |
| --- | |
| *This is an automated suggestion to help route contributions to the appropriate branch.*`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => { | |
| return comment.user.type === 'Bot' && comment.body.includes('Branch Targeting Suggestion') | |
| }); | |
| if (botComment) { | |
| console.log('Suggestion comment already exists.'); | |
| return; | |
| } | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); |
User description
Adds a GitHub Action that automatically comments on new Pull Requests targeting the
masterbranch, suggesting that contributors consider targetingmaintenance-9.xormaintenance-10.xbranches instead when appropriate.masterPR Type
Enhancement
Description
Adds GitHub Action workflow for PR branch suggestions
Automatically comments on PRs targeting master branch
Suggests maintenance-9.x or maintenance-10.x branches
Provides guidance on backward compatibility considerations
Diagram Walkthrough
File Walkthrough
pr-branch-suggestion.yml
GitHub Action workflow for PR branch suggestions.github/workflows/pr-branch-suggestion.yml
targeting master
suggestions
branches
message