From 727dc987fabf1e2ecac26262ca7bd8822dc433e7 Mon Sep 17 00:00:00 2001 From: srinjoy933 Date: Sun, 2 Mar 2025 00:16:37 +0530 Subject: [PATCH 1/4] Apply labels aApply labels automatically at issue creation #888utomatically at issue creation, issue #888 --- .github/ISSUE_TEMPLATE/bug_report.md | 11 +++---- .github/ISSUE_TEMPLATE/feature_request.md | 7 +++-- .github/labeler.yml | 15 +++++++++- .github/workflows/auto-label.yml | 35 +++++++++++++++++++++++ 4 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/auto-label.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3f14d12873..ac4a5796fc 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,10 @@ +bug_report.md: --- name: Bug report about: Create a report to help us improve title: '' -labels: '' +labels: ['bug'] assignees: '' - --- **Describe the bug** @@ -22,19 +22,18 @@ Steps to reproduce the behavior: A clear and concise description of what you expected to happen. **Are you going to work on fixing this?** -No. +- [ ] Yes +- [ ] No **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] @@ -42,3 +41,5 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. + +--- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d61..cbb8682212 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,9 +2,8 @@ name: Feature request about: Suggest an idea for this project title: '' -labels: '' +labels: ['enhancement'] assignees: '' - --- **Is your feature request related to a problem? Please describe.** @@ -16,5 +15,9 @@ A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. +**Are you going to work on implementing this?** +- [ ] Yes +- [ ] No + **Additional context** Add any other context or screenshots about the feature request here. diff --git a/.github/labeler.yml b/.github/labeler.yml index 2710d536eb..7afe6b3a2f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,4 +1,4 @@ -backend: +bbackend: - all: - changed-files: - any-glob-to-any-file: @@ -78,3 +78,16 @@ schema-tests: - changed-files: - any-glob-to-any-file: - schema/tests/** + + +bug: + - title: ['bug', 'error', 'failure', 'not working'] + - body: ['unexpected behavior', 'crash', 'stopped working'] + +enhancement: + - title: ['feature request', 'improve', 'add'] + - body: ['enhancement', 'new functionality', 'extend'] + +question: + - title: ['how to', 'help', 'clarification'] + - body: ['need help', 'question about', 'understanding'] diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml new file mode 100644 index 0000000000..e14d948063 --- /dev/null +++ b/.github/workflows/auto-label.yml @@ -0,0 +1,35 @@ +name: "Auto Label Issues" +on: + issues: + types: [opened, edited] + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Apply Labels to Issues + uses: actions/github-script@v6 + with: + script: | + const issue = context.payload.issue; + const keywords = { + "bug": ["error", "failure", "not working"], + "enhancement": ["feature request", "improve", "add"], + "question": ["how to", "help", "clarification"] + }; + + let labels = []; + for (const [label, words] of Object.entries(keywords)) { + if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) { + labels.push(label); + } + } + + if (labels.length > 0) { + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + }); + } From 107050f7755087d04168cf1d82e87229dded3f2c Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Sat, 1 Mar 2025 18:14:49 -0800 Subject: [PATCH 2/4] Update code --- .github/ISSUE_TEMPLATE/bug_report.md | 10 ++++++---- .github/ISSUE_TEMPLATE/feature_request.md | 3 ++- .github/labeler.yml | 15 +-------------- .github/workflows/auto-label.yml | 14 ++++++++------ 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ac4a5796fc..77a95d0816 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,5 +1,6 @@ -bug_report.md: +bug_report.md --- + name: Bug report about: Create a report to help us improve title: '' @@ -22,18 +23,21 @@ Steps to reproduce the behavior: A clear and concise description of what you expected to happen. **Are you going to work on fixing this?** + - [ ] Yes -- [ ] No +- [x] No **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** + - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] @@ -41,5 +45,3 @@ If applicable, add screenshots to help explain your problem. **Additional context** Add any other context about the problem here. - ---- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index cbb8682212..703cae40fc 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -16,8 +16,9 @@ A clear and concise description of what you want to happen. A clear and concise description of any alternative solutions or features you've considered. **Are you going to work on implementing this?** + - [ ] Yes -- [ ] No +- [x] No **Additional context** Add any other context or screenshots about the feature request here. diff --git a/.github/labeler.yml b/.github/labeler.yml index 7afe6b3a2f..2710d536eb 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,4 +1,4 @@ -bbackend: +backend: - all: - changed-files: - any-glob-to-any-file: @@ -78,16 +78,3 @@ schema-tests: - changed-files: - any-glob-to-any-file: - schema/tests/** - - -bug: - - title: ['bug', 'error', 'failure', 'not working'] - - body: ['unexpected behavior', 'crash', 'stopped working'] - -enhancement: - - title: ['feature request', 'improve', 'add'] - - body: ['enhancement', 'new functionality', 'extend'] - -question: - - title: ['how to', 'help', 'clarification'] - - body: ['need help', 'question about', 'understanding'] diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index e14d948063..09bd84583d 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -1,7 +1,9 @@ name: "Auto Label Issues" on: issues: - types: [opened, edited] + types: + - edited + - opened jobs: label: @@ -14,10 +16,10 @@ jobs: const issue = context.payload.issue; const keywords = { "bug": ["error", "failure", "not working"], - "enhancement": ["feature request", "improve", "add"], - "question": ["how to", "help", "clarification"] + "enhancement": ["add", "feature request", "improve"], + "question": ["clarification", "help", "how to"] }; - + let labels = []; for (const [label, words] of Object.entries(keywords)) { if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) { @@ -28,8 +30,8 @@ jobs: if (labels.length > 0) { github.rest.issues.addLabels({ issue_number: context.issue.number, + labels: labels, owner: context.repo.owner, - repo: context.repo.repo, - labels: labels + repo: context.repo.repo }); } From 6d521e9fada8130c58df1756b48ee4d647e291de Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Sat, 1 Mar 2025 18:18:25 -0800 Subject: [PATCH 3/4] Update code --- .github/workflows/{auto-label.yml => label-issues.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{auto-label.yml => label-issues.yaml} (100%) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/label-issues.yaml similarity index 100% rename from .github/workflows/auto-label.yml rename to .github/workflows/label-issues.yaml From 13ca03955a1f275f52c6135505438b36b0e61137 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Sat, 1 Mar 2025 18:28:44 -0800 Subject: [PATCH 4/4] Update code --- .github/workflows/label-issues.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-issues.yaml b/.github/workflows/label-issues.yaml index 09bd84583d..52d1df4330 100644 --- a/.github/workflows/label-issues.yaml +++ b/.github/workflows/label-issues.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Apply Labels to Issues - uses: actions/github-script@v6 + uses: actions/github-script@v7.0.1 with: script: | const issue = context.payload.issue;