Skip to content

Commit 8163025

Browse files
liya2017liya2017
liya2017
authored and
liya2017
committed
ci: add some comments when an issue assigned
1 parent 5f570c9 commit 8163025

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/issue_comments.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Issue comments
2+
on:
3+
issues:
4+
types: [assigned]
5+
jobs:
6+
issue-comments:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: get assignees
10+
uses: actions/github-script@v6
11+
id: assignees
12+
with:
13+
script: |
14+
const assignees = (
15+
await github.rest.issues.get({
16+
issue_number: context.issue.number,
17+
owner: context.repo.owner,
18+
repo: context.repo.repo
19+
})
20+
).data.assignees;
21+
console.log(assignees);
22+
let assignees_list=``;
23+
for (const name in assignees) {
24+
const assigned = assignees[name];
25+
console.log(assigned.login);
26+
assignees_list=`${assignees_list} @${assigned.login}`;
27+
}
28+
return assignees_list
29+
- name: set output comments
30+
if: contains(github.event.issue.labels.*.name, 't:bug')
31+
run: |
32+
comments="Please fix this bug."
33+
echo "comments=$comments" >> $GITHUB_ENV
34+
- name: set output comments
35+
if: contains(github.event.issue.labels.*.name, 't:feature')
36+
run: |
37+
comments="Please develop this feature."
38+
echo "comments=$comments" >> $GITHUB_ENV
39+
- name: set output comments
40+
if: contains(github.event.issue.labels.*.name, 't:help')
41+
run: |
42+
comments="Please explain this question."
43+
echo "comments=$comments" >> $GITHUB_ENV
44+
- name: set output comments
45+
if: contains(github.event.issue.labels.*.name, 't:others')
46+
run: |
47+
comments="Please work on it."
48+
echo "comments=$comments" >> $GITHUB_ENV
49+
- name: get assignees
50+
id: get_assignees
51+
run: |
52+
echo ${{ steps.assignees.outputs.result}}
53+
inputs=${{ steps.assignees.outputs.result}}
54+
echo "result=$inputs" >> $GITHUB_OUTPUT
55+
- name: Create comment
56+
uses: actions-cool/issues-helper@v3
57+
with:
58+
actions: 'create-comment'
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
issue-number: ${{ github.event.issue.number }}
61+
body: |
62+
Hello ${{ steps.get_assignees.outputs.result}}. ${{ env.comments }}
63+
emoji: 'heart'

0 commit comments

Comments
 (0)