forked from zoningatlas/web-map
-
-
Notifications
You must be signed in to change notification settings - Fork 11
32 lines (32 loc) · 1.08 KB
/
auto-assign-issues.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Auto-assign issue
on:
workflow_dispatch: {}
issues:
types: [opened, edited]
issue_comment:
types: [created, edited]
jobs:
auto_assign:
runs-on: ubuntu-latest
steps:
- name: Check for "assign me"
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue || context.payload.pull_request;
const comment = context.payload.comment;
const phrase = "assign me";
if ((issue && issue.body.includes(phrase)) || (comment && comment.body.includes(phrase))) {
const assignee = comment.user.login;
const issue_number = issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
await octokit.issues.addAssignees({
owner,
repo,
issue_number,
assignees: [assignee],
});
}