mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-04-05 06:56:58 +00:00
61 lines
2.0 KiB
YAML
61 lines
2.0 KiB
YAML
name: 'Tools: Backport'
|
|
|
|
on:
|
|
# zizmor: ignore[dangerous-triggers] - intentional: needs write access for backport PRs, no PR code checkout
|
|
pull_request_target:
|
|
branches:
|
|
- 'master'
|
|
types:
|
|
- 'labeled'
|
|
- 'closed'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
BACKPORT_LABEL_PREFIX: backport-to-
|
|
BACKPORT_LABEL_IGNORE: was-backported
|
|
|
|
jobs:
|
|
backport:
|
|
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
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
|
|
with:
|
|
egress-policy: block
|
|
allowed-endpoints: >
|
|
api.github.com:443
|
|
|
|
- name: Check labels
|
|
id: 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 PR
|
|
if: steps.label_check.outputs.label_check == 'success'
|
|
uses: sorenlouv/backport-github-action@516854e7c9f962b9939085c9a92ea28411d1ae90 # v10.2.0
|
|
with:
|
|
github_token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}
|
|
auto_backport_label_prefix: ${{ env.BACKPORT_LABEL_PREFIX }}
|
|
|
|
- name: Display backport info log
|
|
if: success() && steps.label_check.outputs.label_check == 'success'
|
|
run: cat ~/.backport/backport.info.log
|
|
|
|
- name: Display backport debug log
|
|
if: failure() && steps.label_check.outputs.label_check == 'success'
|
|
run: cat ~/.backport/backport.debug.log
|