From 2d87d33022861e669a406181a06eea366a503476 Mon Sep 17 00:00:00 2001 From: Shubham Ingale <77089227+SGI-CAPP-AT2@users.noreply.github.com> Date: Thu, 31 Oct 2024 09:59:28 +0530 Subject: [PATCH 1/4] added actions actions/checkout@v4 & actions/github-script@v6 --- .github/workflows/issue.yml | 40 +++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index 06da465ccf..4b2df563e5 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -18,12 +18,44 @@ jobs: name: Adding Issue Label runs-on: ubuntu-latest steps: - - uses: Renato66/auto-label@v2.3.0 + - uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/workflows/auto-label.json5 + sparse-checkout-cone-mode: false + - uses: Renato66/auto-label@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - ignore-comments: true - default-labels: '["unapproved"]' - + - uses: actions/github-script@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + script: | + const { owner, repo } = context.repo; + const issue_number = context.issue.number; + + const labels = await github.rest.issues.listLabelsOnIssue({ + owner, + repo, + issue_number + }); + console.log(labels.data, labels.data.reduce((a, c)=>console.log(c.name, c.name in ["security", "ui/ux", "dependencies"]), false)) + if(labels.data.reduce((a, c)=>a||["dependencies"].includes(c.name), false)) + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ["good first issue", "security"] + }); + else if(labels.data.reduce((a, c)=>a||["security", "ui/ux"].includes(c.name), false)) + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ["good first issue"] + }); + + Issue-Greeting: name: Greeting Message to User runs-on: ubuntu-latest From f1eb424af462f2ce2619f4971423468441573089 Mon Sep 17 00:00:00 2001 From: Shubham Ingale <77089227+SGI-CAPP-AT2@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:00:34 +0530 Subject: [PATCH 2/4] Auto-label synonyms and default labels added --- .github/workflows/auto-label.json5 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/auto-label.json5 diff --git a/.github/workflows/auto-label.json5 b/.github/workflows/auto-label.json5 new file mode 100644 index 0000000000..37929ea97b --- /dev/null +++ b/.github/workflows/auto-label.json5 @@ -0,0 +1,8 @@ +{ + "labelsSynonyms": { + "dependencies": ["dependabot", "dependency", "dependencies"], + "security": ["security"], + "ui/ux": ["layout", "screen", "design", "figma"] + }, + "defaultLabels": ["unapproved"], +} \ No newline at end of file From 46b2938b2a337bc2db9c61c07c2f539a8d8454fb Mon Sep 17 00:00:00 2001 From: Shubham Ingale <77089227+SGI-CAPP-AT2@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:21:44 +0530 Subject: [PATCH 3/4] removal of unneccessary log --- .github/workflows/issue.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index 4b2df563e5..277e0fc6b5 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -39,7 +39,6 @@ jobs: repo, issue_number }); - console.log(labels.data, labels.data.reduce((a, c)=>console.log(c.name, c.name in ["security", "ui/ux", "dependencies"]), false)) if(labels.data.reduce((a, c)=>a||["dependencies"].includes(c.name), false)) await github.rest.issues.addLabels({ owner: context.repo.owner, From 8cf9c9b6d4abcec32df482f74bf5b4f09922afab Mon Sep 17 00:00:00 2001 From: Shubham Ingale <77089227+SGI-CAPP-AT2@users.noreply.github.com> Date: Sat, 2 Nov 2024 15:18:14 +0530 Subject: [PATCH 4/4] changes by coderabbitai --- .github/workflows/issue.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index 277e0fc6b5..420d50adbe 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -33,25 +33,25 @@ jobs: script: | const { owner, repo } = context.repo; const issue_number = context.issue.number; - - const labels = await github.rest.issues.listLabelsOnIssue({ + const apiParams = { owner, repo, issue_number - }); + }; + const labels = await github.rest.issues.listLabelsOnIssue(apiParams); if(labels.data.reduce((a, c)=>a||["dependencies"].includes(c.name), false)) await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - labels: ["good first issue", "security"] + labels: ["good first issue", "security"] }); else if(labels.data.reduce((a, c)=>a||["security", "ui/ux"].includes(c.name), false)) await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - labels: ["good first issue"] + labels: ["good first issue"] });