Skip to content

Commit 3d6158a

Browse files
authored
Add NOTE on workflows present on every branch to operate on
1 parent 46cbe89 commit 3d6158a

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.adoc

+24-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,22 @@ If the pattern is found, it looks up the issue `<number>` and closes the backpor
3434

3535
The application is intended to be run as a GitHub Action. Here is an example workflow:
3636

37-
NOTE: The workflow should be present on every branch that you wish to be supported (branches is a filter and the workflow https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#about-workflow-triggers[will not operate] on branches that the workflow is not defined on).
37+
[NOTE]
38+
====
39+
The workflow should be present on every branch that you wish to be supported.
40+
41+
From GItHub's Actions documentation:
42+
43+
> Each workflow run will use the version of the workflow that is present in the associated commit SHA or Git ref of the event. 
44+
This means that when a commit is pushed to these branches, it will not be processed by the backport bot because the workflow is not defined on those branches.
45+
46+
This can be a bit confusing when you see the https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#running-your-workflow-only-when-a-push-to-specific-branches-occurs[branches] element specify that it should operate only on branches that match `*.x`.
47+
However, it is important that the branches entry operates as a https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#using-filters[filter] that further reduces the events that are operated on.
48+
It will not process an event that would not otherwise be processed (e.g. if the workflow does not exist on a branch that belongs to the event).
49+
50+
The usage of these types of filters is primarily meant to ensure that when you create new branches that you can prevent accidental invocation of workflows in branches without having to remember to remove the workflow in the branches.
51+
It also has the benefit of simplifying merging strategies for commits that involve the workflows.
52+
====
3853

3954
.backport-bot.yml
4055
[source,yml]
@@ -71,3 +86,11 @@ jobs:
7186
run: java -jar backport-bot-0.0.1-SNAPSHOT.jar --github.accessToken="$GITHUB_TOKEN" --github.event_name "$GITHUB_EVENT_NAME" --github.event "$GITHUB_EVENT"
7287
----
7388

89+
90+
[add-every-branch]
91+
.Add the Workflow to Every Branch
92+
****
93+
94+
95+
96+
****

0 commit comments

Comments
 (0)