Skip to content

Commit af63e32

Browse files
committed
[docs] Add docs for reusable backport workflow #501
Added instructions and explanation related to the usage of the reusable backport workflow which utilizes korthout/backport-action Related to #501
1 parent 5aa195a commit af63e32

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

docs/developer/reusable-github-utils.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,46 @@ example:
115115
git checkout $VERSION
116116
git reset --hard origin/master
117117
git push origin $VERSION --force-with-lease
118+
119+
Backport Fixes to Stable Branch
120+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121+
122+
This re-usable workflow cherry-picks merged pull requests to stable
123+
branches using `korthout/backport-action
124+
<https://github.com/korthout/backport-action>`_.
125+
126+
Add a ``backport <branch-name>`` label to a pull request (e.g., ``backport
127+
1.1``) and the workflow will create a backport pull request when the
128+
original is merged. Organization members can also comment ``/backport`` on
129+
a merged pull request to trigger it manually.
130+
131+
.. code-block:: yaml
132+
133+
name: Backport fixes to stable branch
134+
135+
on:
136+
pull_request_target:
137+
types: [closed]
138+
issue_comment:
139+
types: [created]
140+
141+
permissions:
142+
contents: write
143+
pull-requests: write
144+
145+
jobs:
146+
backport:
147+
if: >
148+
(
149+
github.event_name == 'pull_request_target' &&
150+
github.event.pull_request.merged
151+
) || (
152+
github.event_name == 'issue_comment' &&
153+
github.event.issue.pull_request &&
154+
github.event.issue.state == 'closed' &&
155+
contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) &&
156+
github.event.comment.body == '/backport'
157+
)
158+
uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
159+
with:
160+
source_pr_number: ${{ github.event.pull_request.number || github.event.issue.number }}

0 commit comments

Comments
 (0)