Skip to content

Commit c9a1d49

Browse files
committed
ci: add workflow for issue label
1 parent d5c500a commit c9a1d49

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/issue-shoot.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## IssueShoot
2+
- 预估时长: {{ .duration }}
3+
- 期望完成时间: {{ .deadline }}
4+
- 开发难度: {{ .level }}
5+
- 参与人数: 1
6+
- 需求对接人: ivringpeng
7+
- 验收标准: 实现期望改造效果,提 PR 并通过验收无误
8+
- 备注: 最终激励以实际提交 `pull request` 并合并为准

.github/workflows/issue-label.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: issue on label
2+
on:
3+
issues:
4+
types: ['labeled']
5+
jobs:
6+
add-issueshoot-template:
7+
runs-on: ubuntu-latest
8+
if: contains(fromJSON('["easy", "middle", "hard"]'), github.event.label.name)
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Get token
13+
id: token
14+
run: |
15+
label=${{ github.event.label.name }}
16+
if [[ $label = "easy" ]]
17+
then
18+
echo "level=低" >> $GITHUB_OUTPUT
19+
echo "duration=1" >> $GITHUB_OUTPUT
20+
deadline=$(date -d "+3 days" +'%Y-%m-%d')
21+
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
22+
elif [[ $label = "middle" ]]
23+
then
24+
echo "level=中" >> $GITHUB_OUTPUT
25+
echo "duration=3" >> $GITHUB_OUTPUT
26+
deadline=$(date -d "+7 days" +'%Y-%m-%d')
27+
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
28+
else
29+
echo "level=高" >> $GITHUB_OUTPUT
30+
echo "duration=5" >> $GITHUB_OUTPUT
31+
deadline=$(date -d "+10 days" +'%Y-%m-%d')
32+
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
33+
fi
34+
- name: Create template
35+
id: template
36+
uses: chuhlomin/render-template@v1.4
37+
with:
38+
template: .github/issue-shoot.md
39+
vars: |
40+
level: ${{ steps.token.outputs.level }}
41+
duration: ${{ steps.token.outputs.duration }}
42+
deadline: ${{ steps.token.outputs.deadline }}
43+
- name: Update issue
44+
uses: actions-cool/issues-helper@v3
45+
with:
46+
actions: 'update-issue'
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
issue-number: ${{ github.event.issue.number }}
49+
body: ${{ steps.template.outputs.result }}
50+
update-mode: 'append'

0 commit comments

Comments
 (0)