From aed6f22cae583838b71084ebc45b335267db2e24 Mon Sep 17 00:00:00 2001 From: Anjaliavv51 <154777864+Anjaliavv51@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:56:33 +0530 Subject: [PATCH 1/5] label #11 --- .github/workflows/auto-label-issues.yml | 53 ++++++++++++++++--------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml index 47e4dbc..c96c41d 100644 --- a/.github/workflows/auto-label-issues.yml +++ b/.github/workflows/auto-label-issues.yml @@ -1,36 +1,53 @@ name: Auto Label Issues + on: issues: types: [opened, edited] + jobs: - label_issues: + auto-label: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 - uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const issue = context.payload.issue; - const title = issue.title.toLowerCase(); const body = issue.body.toLowerCase(); - const labels = []; - if (title.includes('gssoc') || body.includes('gssoc')) { - labels.push('GSSoC'); - } - if (title.includes('enhancement') || body.includes('enhancement')) { - labels.push('Enhancement'); - } - if (title.includes('bug') || body.includes('bug')) { - labels.push('Bug'); + + // Add GSSoC label to all issues + await github.rest.issues.addLabels({ + issue_number: issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['gssoc'] + }); + + // Check for specific keywords and add corresponding labels + if (body.includes('documentation') || body.includes('docs')) { + await github.rest.issues.addLabels({ + issue_number: issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['documentation'] + }); } - if (title.includes('documentation') || body.includes('documentation')) { - labels.push('Documentation'); + + if (body.includes('enhancement') || body.includes('feature')) { + await github.rest.issues.addLabels({ + issue_number: issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['enhancement'] + }); } - if (labels.length > 0) { - github.rest.issues.addLabels({ - issue_number: context.issue.number, + + if (body.includes('bug') || body.includes('error') || body.includes('problem')) { + await github.rest.issues.addLabels({ + issue_number: issue.number, owner: context.repo.owner, - repo: context.repo.name, - labels: labels + repo: context.repo.repo, + labels: ['bug'] }); } \ No newline at end of file From ede95c5f8c8dd69a3ec7fd3d9a984e955dc72cb4 Mon Sep 17 00:00:00 2001 From: Anjaliavv51 <154777864+Anjaliavv51@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:09:01 +0530 Subject: [PATCH 2/5] label label #11 --- .github/workflows/add-gssoc-label-pr.yml | 64 +++++++++++++++--------- .github/workflows/auto-label-issues.yml | 63 ++++++++++++----------- 2 files changed, 73 insertions(+), 54 deletions(-) diff --git a/.github/workflows/add-gssoc-label-pr.yml b/.github/workflows/add-gssoc-label-pr.yml index f835bfa..0f5c18f 100644 --- a/.github/workflows/add-gssoc-label-pr.yml +++ b/.github/workflows/add-gssoc-label-pr.yml @@ -1,43 +1,59 @@ -name: Auto Label PRs +name: Auto Label PR + on: pull_request: - types: [opened, edited, synchronize] + types: [opened, reopened, synchronize] jobs: - label_prs: + label_pr: runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Label PR + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const pr = context.payload.pull_request; - const title = pr.title.toLowerCase(); - const body = pr.body ? pr.body.toLowerCase() : ''; - - const labels = []; - - if (title.includes('gssoc') || body.includes('gssoc')) { - labels.push('GSSoC'); - } + const prBody = pr.body.toLowerCase(); + const prTitle = pr.title.toLowerCase(); - if (title.includes('enhancement') || body.includes('enhancement')) { - labels.push('Enhancement'); - } + // Add gssoc label to all PRs + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: ['gssoc'] + }); - if (title.includes('bug') || body.includes('bug')) { - labels.push('Bug'); + // Check for documentation changes + if (prBody.includes('documentation') || prTitle.includes('doc') || prBody.includes('readme')) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: ['documentation'] + }); } - if (title.includes('documentation') || body.includes('documentation')) { - labels.push('Documentation'); + // Check for enhancements + if (prBody.includes('feature') || prBody.includes('enhancement') || prTitle.includes('add') || prTitle.includes('implement')) { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: ['enhancement'] + }); } - if (labels.length > 0) { - github.rest.issues.addLabels({ - issue_number: context.issue.number, + // Check for bugs + if (prBody.includes('bug') || prBody.includes('fix') || prTitle.includes('fix') || prTitle.includes('resolve')) { + await github.rest.issues.addLabels({ owner: context.repo.owner, - repo: context.repo.name, - labels: labels + repo: context.repo.repo, + issue_number: pr.number, + labels: ['bug'] }); } \ No newline at end of file diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml index c96c41d..31f71b9 100644 --- a/.github/workflows/auto-label-issues.yml +++ b/.github/workflows/auto-label-issues.yml @@ -2,52 +2,55 @@ name: Auto Label Issues on: issues: - types: [opened, edited] + types: [opened, reopened] jobs: auto-label: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/github-script@v6 + - name: Checkout + uses: actions/checkout@v3 + + - name: Apply GSSoC label + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.name, + labels: ['GSSoC'] + }) + + - name: Categorize issue + uses: actions/github-script@v6 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const issue = context.payload.issue; + const title = issue.title.toLowerCase(); const body = issue.body.toLowerCase(); - // Add GSSoC label to all issues - await github.rest.issues.addLabels({ - issue_number: issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['gssoc'] - }); + let labels = []; - // Check for specific keywords and add corresponding labels - if (body.includes('documentation') || body.includes('docs')) { - await github.rest.issues.addLabels({ - issue_number: issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['documentation'] - }); + if (title.includes('doc') || body.includes('doc') || title.includes('readme') || body.includes('readme')) { + labels.push('documentation'); } - if (body.includes('enhancement') || body.includes('feature')) { - await github.rest.issues.addLabels({ - issue_number: issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['enhancement'] - }); + if (title.includes('feature') || body.includes('feature') || title.includes('enhance') || body.includes('enhance')) { + labels.push('enhancement'); + } + + if (title.includes('bug') || body.includes('bug') || title.includes('fix') || body.includes('fix')) { + labels.push('bug'); } - if (body.includes('bug') || body.includes('error') || body.includes('problem')) { - await github.rest.issues.addLabels({ - issue_number: issue.number, + if (labels.length > 0) { + github.rest.issues.addLabels({ + issue_number: context.issue.number, owner: context.repo.owner, - repo: context.repo.repo, - labels: ['bug'] + repo: context.repo.name, + labels: labels }); } \ No newline at end of file From 2fbec5dbd1151fcb9eedb48b81cd63a5cef73d4c Mon Sep 17 00:00:00 2001 From: Lakshmi Pavananjali <154777864+Anjaliavv51@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:18:20 +0530 Subject: [PATCH 3/5] Update add-gssoc-label-pr.yml --- .github/workflows/add-gssoc-label-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/add-gssoc-label-pr.yml b/.github/workflows/add-gssoc-label-pr.yml index ca0c41e..e6959c3 100644 --- a/.github/workflows/add-gssoc-label-pr.yml +++ b/.github/workflows/add-gssoc-label-pr.yml @@ -2,7 +2,7 @@ name: Auto Label PR on: pull_request: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize,,edited] jobs: label_pr: @@ -49,4 +49,4 @@ jobs: // Check for bugs if (prBody.includes('bug') || prBody.includes('fix') || prTitle.includes('fix') || prTitle.includes('resolve')) { await addLabel('bug'); - } \ No newline at end of file + } From 6aba1439927acda24561016f82bdb83ed831e0f2 Mon Sep 17 00:00:00 2001 From: Lakshmi Pavananjali <154777864+Anjaliavv51@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:18:37 +0530 Subject: [PATCH 4/5] Update auto-label-issues.yml --- .github/workflows/auto-label-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml index 2d08dfc..7cb387d 100644 --- a/.github/workflows/auto-label-issues.yml +++ b/.github/workflows/auto-label-issues.yml @@ -2,7 +2,7 @@ name: Auto Label Issues on: issues: - types: [opened, reopened] + types: [opened, reopened,edited] jobs: auto-label: From b68a278917d9db518fe4babd78c3f3ff9c86e752 Mon Sep 17 00:00:00 2001 From: Lakshmi Pavananjali <154777864+Anjaliavv51@users.noreply.github.com> Date: Mon, 29 Jul 2024 15:18:53 +0530 Subject: [PATCH 5/5] Update add-gssoc-label-pr.yml --- .github/workflows/add-gssoc-label-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add-gssoc-label-pr.yml b/.github/workflows/add-gssoc-label-pr.yml index e6959c3..8c85280 100644 --- a/.github/workflows/add-gssoc-label-pr.yml +++ b/.github/workflows/add-gssoc-label-pr.yml @@ -2,7 +2,7 @@ name: Auto Label PR on: pull_request: - types: [opened, reopened, synchronize,,edited] + types: [opened, reopened, synchronize,edited] jobs: label_pr: