Skip to content

Commit

Permalink
Add condition that PRs are merged in backport workflow (#5997)
Browse files Browse the repository at this point in the history
This brings our backport workflow script in line with the script from
the [tibdex/backport][1] github action implementation.

[1]: https://github.com/tibdex/backport/blob/b1bb2aaf611d9f2e5d1900c06493769b9f102a45/.github/workflows/backport.yml#L12-L22

Signed-off-by: Andrew Ross <[email protected]>
  • Loading branch information
andrross authored Jan 24, 2023
1 parent 97c5978 commit 715ff72
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ on:

jobs:
backport:
if: ${{ contains(github.event.label.name, 'backport') }}
name: Backport
runs-on: ubuntu-latest
# 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'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
permissions:
contents: write
pull-requests: write
name: Backport
steps:
- name: GitHub App token
id: github_app_token
Expand Down

0 comments on commit 715ff72

Please sign in to comment.