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
name: Auto Close Issues Based on Labels | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
auto-close-issue: | |
runs-on: ubuntu-latest | |
steps: | |
# 处理 not_planned 关闭类型 | |
- name: Close as not planned | |
if: | | |
contains('❌ 拒绝,😂 移交上游,❌ 忽略,❌ 第三方,❌ 暂无计划', github.event.label.name) | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \ | |
-f state=closed \ | |
-f state_reason="not_planned" | |
# 处理 completed 关闭类型 | |
- name: Close as completed | |
if: github.event.label.name == '👌 完成' | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \ | |
-f state=closed \ | |
-f state_reason="completed" | |
# 处理 duplicate 关闭类型 | |
- name: Close as duplicate | |
if: github.event.label.name == '❌ 重复' | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT }} | |
run: | | |
gh api \ | |
--method PATCH \ | |
/repos/${{ github.repository }}/issues/${{ github.event.issue.number }} \ | |
-f state=closed \ | |
-f state_reason="duplicate" |