Skip to content

Workflow file for this run

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"