Skip to content

Commit

Permalink
Add NOTE on workflows present on every branch to operate on
Browse files Browse the repository at this point in the history
  • Loading branch information
rwinch authored Sep 5, 2024
1 parent 46cbe89 commit 3d6158a
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@ If the pattern is found, it looks up the issue `<number>` and closes the backpor

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

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).
[NOTE]
====
The workflow should be present on every branch that you wish to be supported.
From GItHub's Actions documentation:
> Each workflow run will use the version of the workflow that is present in the associated commit SHA or Git ref of the event. 
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.
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`.
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.
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).
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.
It also has the benefit of simplifying merging strategies for commits that involve the workflows.
====

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


[add-every-branch]
.Add the Workflow to Every Branch
****
****

0 comments on commit 3d6158a

Please sign in to comment.