-
-
Notifications
You must be signed in to change notification settings - Fork 170
Add GitHub Action to auto-label issues and PRs based on title #1407
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThree new files are added under the Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant GitHub as GitHub
participant Action as GitHub Actions Workflow
User->>GitHub: Open or edit issue/PR
GitHub->>Action: Trigger "Label by Title Keyword" workflow
Action->>GitHub: Analyze title, apply matching labels
GitHub-->>User: Issue/PR updated with labels
sequenceDiagram
participant User as User
participant GitHub as GitHub
participant SyncAction as Sync Labels Workflow
User->>GitHub: Push change to .github/labels.yml
GitHub->>SyncAction: Trigger "Sync Labels" workflow
SyncAction->>GitHub: Sync repository labels with labels.yml
GitHub-->>User: Labels updated in repository
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (4)
.github/labels.yml (2)
10-11
: Complete the truncated description for “critical 🚨”.The current description ends mid-sentence (“Event that must be dealt with to ensure the system”).
Provide the full context so future contributors understand exactly when to use this label.- description: "Event that must be dealt with to ensure the system" + description: "Event that must be dealt with to ensure the system remains stable or available"
59-59
: Add a trailing newline to satisfy linters.YAMLlint flags the missing newline at EOF.
This keeps tooling quiet and prevents accidental merge-conflicts on future edits.- description: "SDK-related changes" + description: "SDK-related changes" +.github/workflows/sync-labels.yml (1)
18-20
: Insert a newline at the end of the file.
new-line-at-end-of-file
warning from YAMLlint – quick win to silence CI noise.- skip-delete: false + skip-delete: false +.github/workflows/label-by-title.yml (1)
65-66
: Add trailing newline for consistency.Prevents the same YAMLlint warning triggered in the other files.
- core.info("No matching labels found."); - } + core.info("No matching labels found."); + } +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/labels.yml
(1 hunks).github/workflows/label-by-title.yml
(1 hunks).github/workflows/sync-labels.yml
(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/sync-labels.yml
[error] 20-20: no new line character at the end of file
(new-line-at-end-of-file)
.github/labels.yml
[error] 59-59: no new line character at the end of file
(new-line-at-end-of-file)
🪛 actionlint (1.7.7)
.github/workflows/label-by-title.yml
19-19: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
runs-on: ubuntu-latest | ||
steps: | ||
- name: Label issue or PR based on title keywords | ||
uses: actions/github-script@v6 |
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.
Upgrade to actions/github-script@v7
to avoid deprecation.
Actionlint reports v6’s runner image is too old (Node 16 retirement).
Switch to v7 which ships with Node 20 and is the officially supported version.
- uses: actions/github-script@v6
+ uses: actions/github-script@v7
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
uses: actions/github-script@v6 | |
uses: actions/github-script@v7 |
🧰 Tools
🪛 actionlint (1.7.7)
19-19: the runner of "actions/github-script@v6" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
In .github/workflows/label-by-title.yml at line 19, the GitHub Action uses
actions/github-script@v6, which is deprecated due to an outdated Node version.
Update the version from v6 to v7 to use the latest supported runner image with
Node 20 and avoid deprecation warnings.
"bug 🐞": ["bug", "fix", "error", "fail", "crash", "exception", "not working", "hotfix"], | ||
"enhancement 🌟": ["enhancement", "feature", "feat", "improve", "add", "implement", "request", "support"], | ||
"documentation 📔": ["documentation", "docs", "readme", "guide", "example", "tutorial", "swagger"], | ||
"cleanup 🧹": ["cleanup", "refactor", "style", "chore", "test", "tidy", "debt", "organize", "format", "lint"], | ||
"question 💭": ["question", "help", "how to", "what is", "why", "assist"], | ||
"discussion 🗣️": ["discussion", "propose", "idea", "feedback", "suggestion", "opinion"], | ||
"protocol changed 📝": ["protocol", "api change", "breaking change", "spec", "interface"], | ||
"sdk ⚒️": ["sdk", "client", "library", "package"], | ||
"critical 🚨": ["critical", "urgent", "blocker", "severe", "fatal", "breakdown"], | ||
"dependencies": ["dependency", "dependencies", "bump", "upgrade"], | ||
"duplicate 🧬": ["duplicate", "already exists", "same issue"], | ||
"good first issue 🟣": ["good first issue", "easy", "entry-level"], | ||
"hacktoberfest-accepted": ["hacktoberfest", "accepted", "contribute"], | ||
"hard 🧠": ["hard", "difficult", "tricky", "challenging"], | ||
"help wanted 🦄": ["help wanted", "assistance", "support needed"] | ||
}; |
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.
🛠️ Refactor suggestion
Re-evaluate overly-generic keywords to reduce false positives.
Terms like "accepted"
, "add"
, or "not working"
can unintentionally match many titles, leading to noisy or incorrect labeling (e.g., any PR title containing “add X” will be tagged as an enhancement even if it’s a bug fix).
Consider narrowing or scoping keywords, or adding word-boundary checks/regex matching to cut down on mislabeling.
If needed I can draft a tighter rule set.
🤖 Prompt for AI Agents
In .github/workflows/label-by-title.yml around lines 24 to 39, the keyword lists
for labeling PRs contain overly generic terms like "accepted", "add", and "not
working" that cause false positives. Refine these keyword arrays by replacing
broad terms with more specific phrases or using regex patterns with word
boundaries to ensure only exact matches trigger labels. This will reduce
incorrect labeling by limiting matches to precise keywords relevant to each
category.
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.
Thank you for your contribution.
I’ve confirmed that the current implementation is based on simple keyword matching, and that you're considering AI-based triaging in the future.
However, I think we should reconsider the necessity of this feature and its effectiveness at the current level of implementation.
I’ll reach out to you through another channel to discuss this further.
What this PR does / why we need it:
This PR adds GitHub Actions to automatically triage, label, and assign pull requests (PRs) and issues across all repositories in the yorkie-team organization. Automating these tasks will improve workflow efficiency, enhance issue and PR tracking, and provide better visibility into ongoing contributions.
This feature is especially useful for the Open Source Contribution Academy (OSSCA), enabling automatic labeling of PRs and issues created by mentees and team members. This helps track OSSCA activities and gather related metrics more effectively.
Additionally, this automation will make managing labels easier going forward and help maintain better synchronization across repositories.
Which issue(s) this PR fixes:
Fixes #1041
Special notes for your reviewer:
As an additional suggestion, it might be possible to assign labels based on the highest similarity percentage using AI analyzing the title and content. However, this approach would likely require a paid service.
Also, please note that the current GitHub Action token (
secrets.GH_TOKEN_WITH_WORKFLOW
) is inserted as a placeholder and needs to be updated to fit the yorie repository's settings.Does this PR introduce a user-facing change?:
No user-facing changes.
Checklist:
Summary by CodeRabbit