Git 使用 GitHub Actions 自动删除 merged branch

heroyct · July 10, 2019 · Last by heroyct replied at March 23, 2020 · 7313 hits

以前是 merge 了 branch 以后,自己删除,试着用 github 的新功能 github actions 进行自动化。

方法这里介绍的很详细

https://help.github.com/en/articles/creating-a-workflow-with-github-actions#creating-a-workflow-using-the-file-editor

这次添加下面的文件然后 push 到 github 就行了,完成以后 actions 页面可以进行查看。

文件内容

# .github/main.workflow

workflow "on pull request merge, delete the branch" {
  on = "pull_request"
  resolves = ["branch cleanup"]
}

action "branch cleanup" {
  uses = "jessfraz/branch-cleanup-action@master"
  secrets = ["GITHUB_TOKEN"]
}

然后 merge 一个 branch 以后,就会自动删除它。

不知道大家怎么玩的 github actions

可以用了么

@zzz6519003
可以的,已经用起来了

需要用的组织号申请大半年了还没通过,不需要用的个人号倒是通过了……

知道怎么 自动给 PR 添加标签吗,我看到有自动给 issue 添加 label 的,但是不知道 PR 行不行

Reply to heroyct

This account is already on the waitlist for the GitHub Actions Beta! We'll notify you when we've enabled it on your account. Make sure your primary email address is up-to-date so we can get a hold of you.

@lyb124553153
右边有 label,选择添加

@franklinyu 多谢,已经用上了。

You need to Sign in before reply, if you don't have an account, please Sign up first.