Apply labels automatically at issue creation ,issue no.888#968
Apply labels automatically at issue creation ,issue no.888#968arkid15r merged 6 commits intoOWASP:mainfrom
Conversation
…ically at issue creation, issue OWASP#888
Summary by CodeRabbit
WalkthroughThe pull request updates two GitHub issue templates and introduces a new workflow. The issue templates for bug reports and feature requests have their Changes
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
.github/labeler.yml (1)
18-22: Remove trailing spaces.
A static analysis note indicates trailing whitespace on line 20. Removing these extra spaces will help ensure compliance with YAML linting rules..github/workflows/auto-label.yml (2)
11-11: Update GitHub Script Action Version.
Static analysis indicates thatactions/github-script@v6is outdated. Please consider updating to a more recent version (for example, v6.1.0 or later) to take advantage of improvements and security fixes.🧰 Tools
🪛 actionlint (1.7.4)
11-11: 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)
20-20: Remove trailing spaces.
Trailing whitespace is detected on this line. Removing it will improve the YAML formatting and prevent linting issues.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 20-20: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/ISSUE_TEMPLATE/bug_report.md(2 hunks).github/ISSUE_TEMPLATE/feature_request.md(2 hunks).github/labeler.yml(2 hunks).github/workflows/auto-label.yml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/auto-label.yml
11-11: 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)
🪛 YAMLlint (1.35.1)
.github/workflows/auto-label.yml
[error] 20-20: trailing spaces
(trailing-spaces)
🔇 Additional comments (9)
.github/labeler.yml (4)
1-9: Verify the renaming of the key to "bbackend".
The original key was likely "backend", and it has been intentionally renamed to "bbackend". Please confirm that this change is deliberate and that any downstream configurations or integrations referencing the previous key are updated accordingly.
83-86: New "bug" label configuration added.
The new section for bugs defines keywords for both the title and the body. These keywords appear reasonable for capturing bug-related issues. Please verify that these keywords fully cover your expected patterns.
87-90: New "enhancement" label configuration added.
The configuration for enhancements, with keywords in both title and body, should help in automatically labeling feature requests. Confirm that the lists are sufficiently comprehensive for your use cases.
91-93: New "question" label configuration added.
This section will help capture issues or queries that are phrased as questions. The keywords here are clear and support the intended categorization..github/ISSUE_TEMPLATE/feature_request.md (2)
5-5: Default label set to "enhancement".
Changing the labels field to['enhancement']ensures that feature requests are automatically categorized. This aligns well with the updated labeling strategy.
18-20: Added checkbox for implementation intention.
The new question and checkbox options ("Are you going to work on implementing this?") are a useful addition to prompt contributor engagement. This helps clarify if the reporter intends to take on the feature work..github/workflows/auto-label.yml (1)
13-36: Review the auto-labeling logic.
The script clearly defines a mapping of keywords to labels and iterates through both the issue title and body to apply these labels. This logic should effectively automate the labeling process as intended. Verify that the chosen keywords and the matching logic meet your project's categorization needs.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 20-20: trailing spaces
(trailing-spaces)
.github/ISSUE_TEMPLATE/bug_report.md (2)
6-6: Default bug label set to ['bug'].
Updating the labels field to['bug']ensures that all bug reports are automatically tagged with the correct label, enhancing issue management.
24-26: Added checklist for fix intent.
The reformatted question "Are you going to work on fixing this?" with checkboxes improves clarity regarding contributor involvement on bug fixes. This clear prompt can help streamline issue triaging.
arkid15r
left a comment
There was a problem hiding this comment.
Thanks for adding this
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/auto-label.yml (1)
16-27: Improve Robustness by Handling Potential Nullissue.bodyThe script directly calls
toLowerCase()onissue.body, which may lead to a runtime error ifissue.bodyisnull. Consider initializing a variable forbodywith a null-check before transforming the text. This ensures robustness in cases where the issue body might not be provided.- const issue = context.payload.issue; - const keywords = { - "bug": ["error", "failure", "not working"], - "enhancement": ["add", "feature request", "improve"], - "question": ["clarification", "help", "how to"] - }; + const issue = context.payload.issue; + const title = issue.title.toLowerCase(); + const body = issue.body ? issue.body.toLowerCase() : ""; + const keywords = { + "bug": ["error", "failure", "not working"], + "enhancement": ["add", "feature request", "improve"], + "question": ["clarification", "help", "how to"] + }; - if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) { + if (words.some(word => title.includes(word) || body.includes(word))) {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/ISSUE_TEMPLATE/bug_report.md(2 hunks).github/ISSUE_TEMPLATE/feature_request.md(2 hunks).github/workflows/auto-label.yml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- .github/ISSUE_TEMPLATE/feature_request.md
- .github/ISSUE_TEMPLATE/bug_report.md
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/auto-label.yml
13-13: 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)
🔇 Additional comments (3)
.github/workflows/auto-label.yml (3)
1-7: Workflow Trigger Definition is Clear and ConciseThe workflow triggers correctly on issue events (both "edited" and "opened"). This ensures that the labeling is applied both during issue creation and subsequent modifications.
8-12: Job and Step Configuration Looks SolidThe job setup under
jobs:and the step configuration for applying labels are well-defined and readable. Usingubuntu-latestis appropriate for this action.
30-37: Label Addition Logic is CorrectThe conditional check for non-empty
labelsand the subsequent API call to append labels to the issue are implemented properly. This ensures that only relevant labels are applied.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/label-issues.yaml (1)
16-26: Improve Null Safety for Issue Fields
To avoid potential runtime errors when callingtoLowerCase(), consider assigningissue.titleandissue.bodyto variables with fallback defaults (e.g., an empty string). This change will also reduce redundant function calls.Suggested diff:
- const issue = context.payload.issue; - const keywords = { - "bug": ["error", "failure", "not working"], - "enhancement": ["add", "feature request", "improve"], - "question": ["clarification", "help", "how to"] - }; + const issue = context.payload.issue; + const issueTitle = issue.title ? issue.title.toLowerCase() : ""; + const issueBody = issue.body ? issue.body.toLowerCase() : ""; + const keywords = { + "bug": ["error", "failure", "not working"], + "enhancement": ["add", "feature request", "improve"], + "question": ["clarification", "help", "how to"] + };Also, modify the condition on line 25 as follows:
- if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) { + if (words.some(word => issueTitle.includes(word) || issueBody.includes(word))) {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/label-issues.yaml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/label-issues.yaml
13-13: 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)
🔇 Additional comments (1)
.github/workflows/label-issues.yaml (1)
29-37: Label Addition Logic Verification
The script correctly collects applicable labels and calls GitHub’s API to add these labels to the issue. This implementation meets the objective of auto-labeling issues based on their content.
|
* Apply labels aApply labels automatically at issue creation #888utomatically at issue creation, issue OWASP#888 * Update code * Update code * Update code --------- Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>



Resolves #888
I made several updates to automate issue labeling and improve workflow efficiency. First, I modified labeler.yml to support automatic label assignment based on issue titles and descriptions, ensuring that issues are categorized correctly. Then, I updated the bug_report.md and feature_request.md files inside the .github/ISSUE_TEMPLATE/ folder. In bug_report.md, I added labels: ['bug'] so that all bug reports automatically receive the "bug" label, and I included a checkbox for contributors to indicate whether they will work on fixing the issue. Similarly, in feature_request.md, I added labels: ['enhancement'] to assign the "enhancement" label to new feature requests, along with a checkbox for contributors to confirm if they plan to implement the feature. Additionally, I created a new GitHub Actions workflow (auto-label.yml) inside .github/workflows/, which automatically applies labels to issues based on specific keywords found in the issue title and body. This workflow ensures that issues are categorized even if they are not created using predefined templates.