Skip to content

chore(deps-dev): bump @stylistic/eslint-plugin from 5.7.0 to 5.7.1 #99

chore(deps-dev): bump @stylistic/eslint-plugin from 5.7.0 to 5.7.1

chore(deps-dev): bump @stylistic/eslint-plugin from 5.7.0 to 5.7.1 #99

name: delete-merged-branch
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout code 👋
uses: actions/checkout@v6
- name: Delete merged branch ⛙
uses: actions/github-script@v8
with:
github-token: ${{ secrets.QWY_SYNC_BOT_TOKEN }}
script: |
const { repo: { owner, repo } } = context;
const pr = context.payload.pull_request;
// 跳过 Dependabot 提交的 PR,因为这些PR会被其他流程(dependabot.yml)删除
if (pr.user.login === 'dependabot[bot]') {
console.log('是 Dependabot 提交的 PR,跳过处理');
return;
}
if (!pr.merged) {
console.log('PR 未合并,不删除分支');
return;
}
const branch = pr.head.ref;
console.log(`PR 已合并,正在删除分支: ${branch}`);
await github.rest.git.deleteRef({
owner,
repo,
ref: `heads/${branch}`,
});