From 06eb1b35ed0233701643a1951f9c0e05a5f3ccfa Mon Sep 17 00:00:00 2001 From: Shovit <119912892+Virtual4087@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:30:41 +0545 Subject: [PATCH] Create auto-label.yml --- .github/workflows/auto-label.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/auto-label.yml diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml new file mode 100644 index 0000000..676724f --- /dev/null +++ b/.github/workflows/auto-label.yml @@ -0,0 +1,36 @@ +name: Auto Label Issue + +on: + issues: + types: [opened, reopened, edited] + +jobs: + label_issue: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Label Issue + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const issue = context.payload.issue; + const issueBody = issue.body ? issue.body.toLowerCase() : ''; + const issueTitle = issue.title.toLowerCase(); + + // Add gssoc label to all issues + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: ['hacktoberfest-accepted','hacktoberfest'] + }); + const addLabel = async (label) => { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: [label] + }); + };