-
Notifications
You must be signed in to change notification settings - Fork 15
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
b11e4cf
commit f940504
Showing
1 changed file
with
60 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: auto-PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, review_requested, review_request_removed, review_submitted] | ||
|
||
jobs: | ||
pr_workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Request review from WForst-Breeze on PR creation | ||
if: github.event.action == 'opened' | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ | ||
-d '{"reviewers":["WForst-Breeze"]}' | ||
- name: Add "▲ 合并" label on PR merge | ||
if: github.event.action == 'closed' && github.event.pull_request.merged == true | ||
uses: actions-ecosystem/action-add-labels@v1 | ||
with: | ||
github_token: ${{ secrets.SHEEP }} | ||
labels: '▲ 合并' | ||
|
||
- name: Auto-merge PR with "▲ 合并" label | ||
if: contains(github.event.pull_request.labels.*.name, '▲ 合并') | ||
run: | | ||
curl -X PUT \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge | ||
- name: Add "⇵ 通过" label on approval by WForst-Breeze | ||
if: github.event.action == 'submitted' && github.event.review.state == 'approved' && github.event.review.user.login == 'WForst-Breeze' | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \ | ||
-d '{"labels":["⇵ 通过"]}' | ||
- name: Close PR with specific labels | ||
if: contains(github.event.pull_request.labels.*.name, '× 重新编写') || contains(github.event.pull_request.labels.*.name, '× 无效') || contains(github.event.pull_request.labels.*.name, '× 拒绝') | ||
run: | | ||
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.pull_request.number }} \ | ||
-d '{"state":"closed"}' | ||
- name: Add "◈ 修正" label on request changes | ||
if: github.event.action == 'submitted' && github.event.review.state == 'changes_requested' | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.SHEEP }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \ | ||
-d '{"labels":["◈ 修正"]}' |