Skip to content

Commit

Permalink
换用现成工作流来完成任务
Browse files Browse the repository at this point in the history
  • Loading branch information
emptylight370 authored Nov 5, 2024
1 parent bf92110 commit b30f56b
Showing 1 changed file with 24 additions and 33 deletions.
57 changes: 24 additions & 33 deletions .github/workflows/issue-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,32 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Check checkbox
id: check-issue
run: |
ISSUE_BODY="${{ github.event.issue.body }}"
# echo "$ISSUE_BODY"
if [[ "$ISSUE_BODY" == *"- [X] I didn't check all the checkboxes"* ]]; then
echo "Checkbox is checked"
echo "checkbox_checked=true" >> $GITHUB_ENV
echo "available=true" >> $GITHUB_ENV
elif [[ "$ISSUE_BODY" == *"- [ ] I didn't check all the checkboxes"* ]]; then
echo "Checkbox is not checked"
echo "checkbox_checked=false" >> $GITHUB_ENV
echo "available=true" >> $GITHUB_ENV
else
echo "Checkbox doesn't exist"
echo "checkbox_checked=false" >> $GITHUB_ENV
echo "available=false" >> $GITHUB_ENV
fi
- name: Close issue on check
if: env.checkbox_checked == 'true'
run: |
gh issue close ${{ github.event.issue.number }} --comment $'The issue is closed because it should be. If you want to re-open it, please edit and check your issue then re-open it.\n这个议题因为应被关闭而被关闭了。如果你想要重新打开它,请编辑并检查你的议题再重新打开它。'
gh issue edit ${{ github.event.issue.number }} --add-label "invalid"
if: contains(github.event.issue.body, '- [X] I didn''t check all the checkboxes')
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,add-labels'
labels: 'invalid'
body: |
The issue is closed because it should be. If you want to re-open it, please edit and check your issue then re-open it.
这个议题因为应被关闭而被关闭了。如果你想要重新打开它,请编辑并检查你的议题再重新打开它。
- name: Comment issue on not check
if: env.checkbox_checked == 'false' && env.available == 'true'
run: |
gh issue comment ${{ github.event.issue.number }} --body $'Thank you for confirming the issue.\n感谢提交议题。'
if gh issue view ${{ github.event.issue.number }} --json labels --jq '.labels | map(.name) | contains(["'"invalid"'"])'; then
gh issue edit ${{ github.event.issue.number }} --remove-label "invalid"
fi
if: contains(github.event.issue.body, '- [ ] I didn''t check all the checkboxes')
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,remove-labels'
labels: 'invalid'
body: |
Thank you for confirming the issue.
感谢提交议题。
- name: Comment issue on no checkbox
if: env.checkbox_checked == 'false' && env.available == 'false'
run: |
gh issue comment ${{ github.event.issue.number }} --body $'Your issue is not generated from template. Please make sure your issue includes all the necessary infomation. If you submitted this issue from template, please ignore this message, there may be some problems.\n你的议题不是从模板生成的。请确保你的议题包含所有必须的信息。如果你从模板新建了这个议题,请忽略这条消息,可能出现了一些问题。'
gh issue edit ${{ github.event.issue.number }} --add-label "not template"
if: contains(github.event.issue.body, '- [ ] I didn''t check all the checkboxes') == false && contains(github.event.issue.body, '- [X] I didn''t check all the checkboxes') == false
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment,add-labels'
labels: 'not template'
body: |
Your issue is not generated from template. Please make sure your issue includes all the necessary infomation. If you submitted this issue from template, please ignore this message, there may be some problems.
你的议题不是从模板生成的。请确保你的议题包含所有必须的信息。如果你从模板新建了这个议题,请忽略这条消息,可能出现了一些问题。

0 comments on commit b30f56b

Please sign in to comment.