From 05bf66e0d4964b6588e8c5865c7902c53c89d636 Mon Sep 17 00:00:00 2001 From: Mukundan Sundararajan Date: Sat, 13 Nov 2021 03:52:23 +0530 Subject: [PATCH] Add auto-assign dapr_bot workflow (#654) --- .github/workflows/dapr_bot.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/dapr_bot.yml diff --git a/.github/workflows/dapr_bot.yml b/.github/workflows/dapr_bot.yml new file mode 100644 index 000000000..94c30415c --- /dev/null +++ b/.github/workflows/dapr_bot.yml @@ -0,0 +1,31 @@ +name: dapr-bot + +on: + issue_comment: {types: created} + +jobs: + daprbot: + name: bot-processor + runs-on: ubuntu-latest + steps: + - name: Comment analyzer + uses: actions/github-script@v1 + with: + github-token: ${{secrets.DAPR_BOT_TOKEN}} + script: | + const payload = context.payload; + const issue = context.issue; + const isFromPulls = !!payload.issue.pull_request; + const commentBody = payload.comment.body; + + if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) { + if (!issue.assignees || issue.assignees.length === 0) { + await github.issues.addAssignees({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + assignees: [context.actor], + }) + } + return; + } \ No newline at end of file