forked from PCL-Community/PCL2-CE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2eb2df
commit f115514
Showing
1 changed file
with
19 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
name: Issue Management | ||
name: Close Issues Based on Labels | ||
|
||
on: | ||
issues: | ||
types: | ||
- labeled | ||
- closed | ||
types: [labeled] | ||
|
||
jobs: | ||
manage_issues: | ||
close-issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up authentication | ||
run: echo "GITHUB_TOKEN=${{ secrets.SHEEP }}" >> $GITHUB_ENV | ||
|
||
- name: Install jq | ||
run: sudo apt-get update && sudo apt-get install -y jq | ||
- name: Close issue as not planned if labeled with '❌ 拒绝' | ||
if: github.event.label.name == '❌ 拒绝' | ||
uses: peter-evans/close-issue@v3 | ||
with: | ||
state: closed | ||
reason: 'not_planned' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SHEEP }} | ||
|
||
- name: Handle labeled issues | ||
if: github.event.action == 'labeled' | ||
run: | | ||
if [[ "${{ github.event.label.name }}" == "❌ 拒绝" || "${{ github.event.label.name }}" == "😂 移交上游" ]]; then | ||
curl -X PATCH \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \ | ||
-d '{"state": "closed", "state_reason": "not_planned"}' | ||
elif [[ "${{ github.event.label.name }}" == "👌 完成" ]]; then | ||
curl -X PATCH \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \ | ||
-d '{"state": "closed", "state_reason": "completed"}' | ||
fi | ||
- name: Close issue as completed if labeled with '👌 完成' | ||
if: github.event.label.name == '👌 完成' | ||
uses: peter-evans/close-issue@v3 | ||
with: | ||
state: closed | ||
reason: 'completed' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.SHEEP }} |