Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow for issue label #2953

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/issue-shoot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## IssueShoot
- 预估时长: {{ .duration }}
- 期望完成时间: {{ .deadline }}
- 开发难度: {{ .level }}
- 参与人数: 1
- 验收标准: 实现期望改造效果,提 PR 并通过验收无误
- 备注: 最终激励以实际提交 `pull request` 并合并为准
50 changes: 50 additions & 0 deletions .github/workflows/issue-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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/render-template@v1.4
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'
Loading