Skip to content

Tighten adoption filters #777

Tighten adoption filters

Tighten adoption filters #777

Workflow file for this run

name: Pull Request backporting
on:
# zizmor: ignore[dangerous-triggers] only runs on merged PRs, never checks out code
pull_request_target:
types:
- closed
- labeled
permissions:
contents: read
pull-requests: write
jobs:
backport_v1_0:
name: "Backport to v1.0"
# 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.0')
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport-v1.0')
)
)
runs-on: ubuntu-latest
steps:
- name: Generate a token from the orc-backport-bot github-app
id: generate_token
uses: getsentry/action-github-app-token@5c1e90706fe007857338ac1bfbd7a4177db2f789 # tag=v4.0.0
with:
app_id: ${{ secrets.BACKPORT_APP_ID }} # zizmor: ignore[secrets-outside-env]
private_key: ${{ secrets.BACKPORT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
- name: Backporting
if: >
contains(github.event.pull_request.labels.*.name, 'semver:patch')
|| contains(github.event.label.name, 'semver:patch')
uses: kiegroup/git-backporting@08da0b07ef2330d189f6074ec8db736b3aa9f465 # tag=v4.9.1
with:
target-branch: release-1.0
pull-request: ${{ github.event.pull_request.url }}
auth: ${{ steps.generate_token.outputs.token }}
no-squash: true
strategy-option: find-renames
- name: Report failure
if: failure()
run: gh issue comment "$NUMBER" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
BODY: >
Failed to backport PR to `release-1.0` branch. See [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
- name: Report an error if backport unsupported labels
if: >
contains(github.event.pull_request.labels.*.name, 'semver:major')
|| contains(github.event.pull_request.labels.*.name, 'semver:minor')
|| contains(github.event.label.name, 'semver:major')
|| contains(github.event.label.name, 'semver:minor')
run: gh pr comment "$NUMBER" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
BODY: >
Labels `semver:major` and `semver:minor` block backports to the branch `release-1.0`.
backport_v2_0:
name: "Backport to v2.0"
# 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-v2.0')
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport-v2.0')
)
)
runs-on: ubuntu-latest
steps:
- name: Generate a token from the orc-backport-bot github-app
id: generate_token
uses: getsentry/action-github-app-token@5c1e90706fe007857338ac1bfbd7a4177db2f789 # tag=v4.0.0
with:
app_id: ${{ secrets.BACKPORT_APP_ID }} # zizmor: ignore[secrets-outside-env]
private_key: ${{ secrets.BACKPORT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
- name: Backporting
if: >
contains(github.event.pull_request.labels.*.name, 'semver:patch')
|| contains(github.event.pull_request.labels.*.name, 'semver:minor')
|| contains(github.event.label.name, 'semver:patch')
|| contains(github.event.label.name, 'semver:minor')
uses: kiegroup/git-backporting@08da0b07ef2330d189f6074ec8db736b3aa9f465 # tag=v4.9.1
with:
target-branch: release-2.0
pull-request: ${{ github.event.pull_request.url }}
auth: ${{ steps.generate_token.outputs.token }}
no-squash: true
strategy-option: find-renames
- name: Report failure
if: failure()
run: gh issue comment "$NUMBER" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
BODY: >
Failed to backport PR to `release-2.0` branch. See [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
- name: Report an error if backport unsupported labels
if: >
contains(github.event.pull_request.labels.*.name, 'semver:major')
|| contains(github.event.label.name, 'semver:major')
run: gh pr comment "$NUMBER" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
BODY: >
Label `semver:major` blocks backports to the branch `release-2.0`.