-
Notifications
You must be signed in to change notification settings - Fork 75
feat: Add PR Dashboard #500
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
Open
aceppaluni
wants to merge
4
commits into
hiero-ledger:main
Choose a base branch
from
aceppaluni:prui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "maintainerTeam": "@hiero-ledger/hiero-website-maintainers", | ||
| "goodFirstIssueSupportTeam": "@hiero-ledger/hiero-website-good-first-issue-support", | ||
|
|
||
| "labels": { | ||
| "status": { | ||
| "awaitingTriage": "status: awaiting triage", | ||
| "readyForDev": "status: ready for dev", | ||
| "inProgress": "status: in progress", | ||
| "blocked": "status: blocked", | ||
| "needsReview": "status: needs review", | ||
| "needsRevision": "status: needs revision" | ||
| }, | ||
| "skill": { | ||
| "goodFirstIssue": "skill: good first issue", | ||
| "beginner": "skill: beginner", | ||
| "intermediate": "skill: intermediate", | ||
| "advanced": "skill: advanced" | ||
| }, | ||
| "priority": { | ||
| "critical": "priority: critical", | ||
| "high": "priority: high", | ||
| "medium": "priority: medium", | ||
| "low": "priority: low" | ||
| } | ||
| }, | ||
|
|
||
| "skillHierarchy": [ | ||
| "skill: good first issue", | ||
| "skill: beginner", | ||
| "skill: intermediate", | ||
| "skill: advanced" | ||
| ], | ||
|
|
||
| "priorityHierarchy": [ | ||
| "priority: critical", | ||
| "priority: high", | ||
| "priority: medium", | ||
| "priority: low" | ||
| ], | ||
|
|
||
| "skillPrerequisites": { | ||
| "skill: good first issue": { | ||
| "requiredLabel": null, | ||
| "requiredCount": 0, | ||
| "displayName": "Good First Issue" | ||
| }, | ||
| "skill: beginner": { | ||
| "requiredLabel": "skill: good first issue", | ||
| "requiredCount": 2, | ||
| "displayName": "Beginner", | ||
| "prerequisiteDisplayName": "Good First Issues" | ||
| }, | ||
| "skill: intermediate": { | ||
| "requiredLabel": "skill: beginner", | ||
| "requiredCount": 3, | ||
| "displayName": "Intermediate", | ||
| "prerequisiteDisplayName": "Beginner Issues" | ||
| }, | ||
| "skill: advanced": { | ||
| "requiredLabel": "skill: intermediate", | ||
| "requiredCount": 3, | ||
| "displayName": "Advanced", | ||
| "prerequisiteDisplayName": "Intermediate Issues" | ||
| } | ||
| }, | ||
|
|
||
| "assignmentLimits": { | ||
| "maxOpenAssignments": 2, | ||
| "maxGfiCompletions": 5 | ||
| }, | ||
|
|
||
| "documentation": { | ||
| "workflowGuide": "https://github.com/hiero-ledger/hiero-website/blob/main/docs/training/workflow.md" | ||
| }, | ||
|
|
||
| "community": { | ||
| "discordChannel": "https://discord.com/channels/905194001349627914/1458790070986215567" | ||
| } | ||
| } |
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,75 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // bot-on-pr-open.js | ||
| // | ||
| // Runs when a PR is opened, reopened, or converted from draft (ready_for_review). | ||
| // Performs all 4 checks (DCO, GPG, merge conflict, issue link), posts/updates | ||
| // the unified dashboard comment, auto-assigns the author, and applies the | ||
| // appropriate status label. | ||
|
|
||
| import { | ||
| createLogger, | ||
| buildBotContext, | ||
| addAssignees, | ||
| requireSafeUsername, | ||
| runAllChecksAndComment, | ||
| swapStatusLabel, | ||
| } from './helpers.js'; | ||
|
|
||
| const logger = createLogger('on-pr-open'); | ||
|
|
||
| /** | ||
| * Auto-assigns the PR author if not already assigned. | ||
| * @param {object} botContext | ||
| */ | ||
| async function autoAssignAuthor(botContext) { | ||
| const prAuthor = botContext.pr?.user?.login; | ||
| if (!prAuthor) { | ||
| logger.log('Exit: missing pull request author'); | ||
| return; | ||
| } | ||
| try { | ||
| requireSafeUsername(prAuthor, 'pr.author'); | ||
| } catch (err) { | ||
| logger.log('Exit: invalid pr.author', err.message); | ||
| return; | ||
| } | ||
|
|
||
| const currentAssignees = botContext.pr?.assignees || []; | ||
| const isAlreadyAssigned = currentAssignees.some( | ||
| (a) => (a?.login || '').toLowerCase() === prAuthor.toLowerCase() | ||
| ); | ||
| if (isAlreadyAssigned) { | ||
| logger.log(`Author ${prAuthor} is already assigned`); | ||
| return; | ||
| } | ||
| await addAssignees(botContext, [prAuthor]); | ||
| } | ||
|
|
||
| export default async ({ github, context }) => { | ||
| try { | ||
| const botContext = buildBotContext({ github, context }); | ||
|
|
||
| await autoAssignAuthor(botContext); | ||
|
|
||
| if (botContext.pr?.user?.type === 'Bot') { | ||
| logger.log('Skipping bot-authored PR'); | ||
| return; | ||
| } | ||
|
|
||
| const { allPassed } = await runAllChecksAndComment(botContext); | ||
| const result = await swapStatusLabel(botContext, allPassed, { force: true }); | ||
|
|
||
| if (!result.success) { | ||
| logger.error(`Failed to swap status label: ${result.errorDetails}`); | ||
| } | ||
|
|
||
| logger.log('On-PR-open bot completed'); | ||
| } catch (error) { | ||
| logger.error('Error:', { | ||
| message: error.message, | ||
| number: context?.payload?.pull_request?.number, | ||
| }); | ||
| throw error; | ||
| } | ||
| }; | ||
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,48 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // bot-on-pr-update.js | ||
| // | ||
| // Runs on new commits (synchronize) and PR body edits (edited). Performs all | ||
| // 4 checks (DCO, GPG, merge conflict, issue link), posts/updates the unified | ||
| // dashboard comment, and conditionally swaps the status label. | ||
| // For edited events, exits early if only the title or base branch changed. | ||
|
|
||
| import { | ||
| createLogger, | ||
| buildBotContext, | ||
| swapStatusLabel, | ||
| runAllChecksAndComment, | ||
| } from './helpers.js'; | ||
|
|
||
| const logger = createLogger('on-pr-update'); | ||
|
|
||
| export default async ({ github, context }) => { | ||
| try { | ||
| const botContext = buildBotContext({ github, context }); | ||
|
|
||
| if (botContext.pr?.user?.type === 'Bot') { | ||
| logger.log('Skipping bot-authored PR'); | ||
| return; | ||
| } | ||
|
|
||
| // Edits can be triggered by title changes, but we only care about body changes. | ||
| if (context.payload.action === 'edited' && !context.payload.changes?.body) { | ||
| logger.log('Body not changed, skipping'); | ||
| return; | ||
| } | ||
|
|
||
| const { allPassed } = await runAllChecksAndComment(botContext); | ||
| const result = await swapStatusLabel(botContext, allPassed); | ||
| if (!result.success) { | ||
| logger.error(`Failed to swap status label: ${result.errorDetails}`); | ||
| } | ||
|
|
||
| logger.log('On-PR-update bot completed'); | ||
| } catch (error) { | ||
| logger.error('Error:', { | ||
| message: error.message, | ||
| number: context?.payload?.pull_request?.number, | ||
| }); | ||
| throw error; | ||
| } | ||
| }; | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Force status-label reconciliation on update events.
Line 35 calls
swapStatusLabelwithoutforce, so PRs missing both status labels won’t recover a status label on synchronize/edited events.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents