Skip to content

Commit

Permalink
Add condition that PRs are merged in backport workflow (opensearch-pr…
Browse files Browse the repository at this point in the history
…oject#5997)

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 <andrross@amazon.com>
(cherry picked from commit 715ff72)
  • Loading branch information
andrross committed Jan 25, 2023
1 parent b78b25a commit 3471d64
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ on:

jobs:
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 3471d64

Please sign in to comment.