mirror of
https://code.forgejo.org/actions/git-backporting.git
synced 2025-02-23 11:05:44 -05:00
docs: Add pull-request trigger example (#28)
Document how to use this action to trigger a backport directly from a pull request, using labels.
This commit is contained in:
parent
ee94ec83f6
commit
1732481b37
1 changed files with 36 additions and 0 deletions
36
README.md
36
README.md
|
@ -93,6 +93,42 @@ jobs:
|
||||||
|
|
||||||
You can also use this action with other events - you'll just need to specify `target-branch` and `pull-request` params.
|
You can also use this action with other events - you'll just need to specify `target-branch` and `pull-request` params.
|
||||||
|
|
||||||
|
For example, this configuration creates a pull request against branch `v1` once the current one is merged, provided that the label `backport-v1` is applied:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Pull Request Backporting using BPer
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
- labeled
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
backporting:
|
||||||
|
name: "Backporting"
|
||||||
|
# Only react to merged PRs for security reasons.
|
||||||
|
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
|
||||||
|
if: >
|
||||||
|
github.event.pull_request.merged
|
||||||
|
&& (
|
||||||
|
github.event.action == 'closed'
|
||||||
|
&& contains(github.event.pull_request.labels.*.name, 'backport-v1')
|
||||||
|
|| (
|
||||||
|
github.event.action == 'labeled'
|
||||||
|
&& contains(github.event.label.name, 'backport-v1')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Backporting
|
||||||
|
uses: lampajr/backporting@main
|
||||||
|
with:
|
||||||
|
target-branch: v1
|
||||||
|
pull-request: ${{ github.event.pull_request.url }}
|
||||||
|
auth: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
For a complete description of all inputs see [Inputs section](#inputs).
|
For a complete description of all inputs see [Inputs section](#inputs).
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
Loading…
Add table
Reference in a new issue