mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-04-14 16:50:04 +00:00
48 lines
1.8 KiB
YAML
48 lines
1.8 KiB
YAML
name: Prowler - Automatic Backport
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches: ['master']
|
|
types: ['labeled', 'closed']
|
|
|
|
env:
|
|
# The prefix of the label that triggers the backport must not contain the branch name
|
|
# so, for example, if the branch is 'master', the label should be 'backport-to-<branch>'
|
|
BACKPORT_LABEL_PREFIX: backport-to-
|
|
BACKPORT_LABEL_IGNORE: was-backported
|
|
|
|
jobs:
|
|
backport:
|
|
name: Backport PR
|
|
if: github.event.pull_request.merged == true && !(contains(github.event.pull_request.labels.*.name, 'backport')) && !(contains(github.event.pull_request.labels.*.name, 'was-backported'))
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
pull-requests: write
|
|
contents: write
|
|
steps:
|
|
- name: Check labels
|
|
id: preview_label_check
|
|
uses: agilepathway/label-checker@c3d16ad512e7cea5961df85ff2486bb774caf3c5 # v1.6.65
|
|
with:
|
|
allow_failure: true
|
|
prefix_mode: true
|
|
any_of: ${{ env.BACKPORT_LABEL_PREFIX }}
|
|
none_of: ${{ env.BACKPORT_LABEL_IGNORE }}
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Backport Action
|
|
if: steps.preview_label_check.outputs.label_check == 'success'
|
|
uses: sorenlouv/backport-github-action@ad888e978060bc1b2798690dd9d03c4036560947 # v9.5.1
|
|
with:
|
|
github_token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}
|
|
auto_backport_label_prefix: ${{ env.BACKPORT_LABEL_PREFIX }}
|
|
|
|
- name: Info log
|
|
if: ${{ success() && steps.preview_label_check.outputs.label_check == 'success' }}
|
|
run: cat ~/.backport/backport.info.log
|
|
|
|
- name: Debug log
|
|
if: ${{ failure() && steps.preview_label_check.outputs.label_check == 'success' }}
|
|
run: cat ~/.backport/backport.debug.log
|