Skip to content

Commit 3b5aebf

Browse files
committed
👷 ci(bot): copycat assign-bot from dapr [no ci]
1 parent 3614f23 commit 3b5aebf

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/assign-bot.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# ------------------------------------------------------------
2+
# Copyright 2021 The Dapr Authors
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# ------------------------------------------------------------
13+
14+
name: assign-bot
15+
16+
on:
17+
issue_comment:
18+
types: [created]
19+
20+
jobs:
21+
daprbot:
22+
name: bot-processor
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Comment analyzer
26+
uses: actions/github-script@v1
27+
with:
28+
github-token: ${{secrets.GITHUB_TOKEN}}
29+
script: |
30+
const payload = context.payload;
31+
const issue = context.issue;
32+
const isFromPulls = !!payload.issue.pull_request;
33+
const commentBody = payload.comment.body;
34+
35+
if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) {
36+
if (!issue.assignees || issue.assignees.length === 0) {
37+
await github.issues.addAssignees({
38+
owner: issue.owner,
39+
repo: issue.repo,
40+
issue_number: issue.number,
41+
assignees: [context.actor],
42+
})
43+
}
44+
45+
return;
46+
}

0 commit comments

Comments
 (0)