github / github/docs

Behavior of `branches` filter on existing branches

未关闭
#42,813 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
content github_actions never-stale
主要语言
TypeScript
星标
20.8k
派生
68.7k
平均合并
13 小时 17 分钟
30 天内合并 PR
110

描述

### Code of Conduct

- [x] I have read and agree to the GitHub Docs project's [Code of Conduct](https://github.com/github/docs/blob/main/.github/CODE_OF_CONDUCT.md)

### What article on docs.github.com is affected?

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax

### What part(s) of the article would you like to see updated?

These to parts that describe using a `branches` filter:

- [on..](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpull_requestpull_request_targetbranchesbranches-ignore)
- [on.push.](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpushbranchestagsbranches-ignoretags-ignore)

### Additional information

I just lost about 5 hours trying a large variety of variations and reviewing the docs related to `branches` filters on GitHub Actions. Here is what I discovered, and I believe this important fact is nowhere in the docs and should be:

```
When a workflow is put in place that has a `branches` filter, or modified
to add additional branches to an existing `branches` filter, any matching
branches that already existed PRIOR to this modification are NOT eligible
to trigger the workflow.

Only new branches added AFTER the workflow is in place, with matching
branch names, can trigger the workflow.
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。