Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

minwoo1999
Copy link
Contributor

@minwoo1999 minwoo1999 commented Jul 27, 2025

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.

Add GitHub Actions for automated labeling and triage of issues and pull requests to improve contribution management and OSSCA tracking.

Checklist:

  • Added relevant tests or not required
  • Addressed and resolved all CodeRabbit review comments
  • Didn't break anything

Summary by CodeRabbit

  • Chores
    • Introduced a standardized set of GitHub labels for better issue and pull request organization.
    • Added automated workflows to sync labels with the configuration and to automatically label issues and pull requests based on title keywords.

Copy link

coderabbitai bot commented Jul 27, 2025

Walkthrough

Three new files are added under the .github directory: a standardized label configuration file, an automated labeling workflow that applies labels based on issue/PR titles, and a workflow that synchronizes repository labels with the configuration. No application code or exported entities are modified.

Changes

File(s) Change Summary
.github/labels.yml New configuration file defining standardized labels for issues and pull requests.
.github/workflows/label-by-title.yml New GitHub Actions workflow to automatically label issues/PRs based on title keywords.
.github/workflows/sync-labels.yml New GitHub Actions workflow to synchronize repository labels with .github/labels.yml configuration.

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
Loading
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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Suggested reviewers

  • hackerwins

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 65a0cff and 4e5607f.

📒 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
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
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.

Comment on lines +24 to +39
"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"]
};
Copy link

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.

@krapie krapie self-requested a review July 28, 2025 14:40
@krapie krapie changed the title feat: add GitHub Action to auto-label issues and PRs based on title k… Add GitHub Action to auto-label issues and PRs based on title Jul 28, 2025
Copy link
Member

@krapie krapie left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add GitHub Actions for Automated Labeling and Triage of PRs and Issues
2 participants