-
Notifications
You must be signed in to change notification settings - Fork 483
50 lines (50 loc) · 1.73 KB
/
issue-label.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: issue on label
on:
issues:
types: ['labeled']
jobs:
add-issueshoot-template:
runs-on: ubuntu-latest
if: contains(fromJSON('["easy", "middle", "hard"]'), github.event.label.name)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get token
id: token
run: |
label=${{ github.event.label.name }}
if [[ $label = "easy" ]]
then
echo "level=低" >> $GITHUB_OUTPUT
echo "duration=1" >> $GITHUB_OUTPUT
deadline=$(date -d "+3 days" +'%Y-%m-%d')
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
elif [[ $label = "middle" ]]
then
echo "level=中" >> $GITHUB_OUTPUT
echo "duration=3" >> $GITHUB_OUTPUT
deadline=$(date -d "+7 days" +'%Y-%m-%d')
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
else
echo "level=高" >> $GITHUB_OUTPUT
echo "duration=5" >> $GITHUB_OUTPUT
deadline=$(date -d "+10 days" +'%Y-%m-%d')
echo "deadline=${deadline}" >> $GITHUB_OUTPUT
fi
- name: Create template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/issue-shoot.md
vars: |
level: ${{ steps.token.outputs.level }}
duration: ${{ steps.token.outputs.duration }}
deadline: ${{ steps.token.outputs.deadline }}
- name: Update issue
uses: actions-cool/issues-helper@v3
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: ${{ steps.template.outputs.result }}
update-mode: 'append'