|
69 | 69 | NUMBER: ${{ github.event.pull_request.number }} |
70 | 70 | BODY: > |
71 | 71 | Labels `semver:major` and `semver:minor` block backports to the branch `release-1.0`. |
| 72 | +
|
| 73 | + backport_v2_0: |
| 74 | + name: "Backport to v2.0" |
| 75 | + # Only react to merged PRs for security reasons. |
| 76 | + # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. |
| 77 | + if: > |
| 78 | + github.event.pull_request.merged |
| 79 | + && ( |
| 80 | + github.event.action == 'closed' |
| 81 | + && contains(github.event.pull_request.labels.*.name, 'backport-v2.0') |
| 82 | + || ( |
| 83 | + github.event.action == 'labeled' |
| 84 | + && contains(github.event.label.name, 'backport-v2.0') |
| 85 | + ) |
| 86 | + ) |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - name: Generate a token from the orc-backport-bot github-app |
| 90 | + id: generate_token |
| 91 | + uses: getsentry/action-github-app-token@5c1e90706fe007857338ac1bfbd7a4177db2f789 # tag=v4.0.0 |
| 92 | + with: |
| 93 | + app_id: ${{ secrets.BACKPORT_APP_ID }} # zizmor: ignore[secrets-outside-env] |
| 94 | + private_key: ${{ secrets.BACKPORT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] |
| 95 | + |
| 96 | + - name: Backporting |
| 97 | + if: > |
| 98 | + contains(github.event.pull_request.labels.*.name, 'semver:patch') |
| 99 | + || contains(github.event.pull_request.labels.*.name, 'semver:minor') |
| 100 | + || contains(github.event.label.name, 'semver:patch') |
| 101 | + || contains(github.event.label.name, 'semver:minor') |
| 102 | + uses: kiegroup/git-backporting@08da0b07ef2330d189f6074ec8db736b3aa9f465 # tag=v4.9.1 |
| 103 | + with: |
| 104 | + target-branch: release-2.0 |
| 105 | + pull-request: ${{ github.event.pull_request.url }} |
| 106 | + auth: ${{ steps.generate_token.outputs.token }} |
| 107 | + no-squash: true |
| 108 | + strategy-option: find-renames |
| 109 | + |
| 110 | + - name: Report failure |
| 111 | + if: failure() |
| 112 | + run: gh issue comment "$NUMBER" --body "$BODY" |
| 113 | + env: |
| 114 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 115 | + GH_REPO: ${{ github.repository }} |
| 116 | + NUMBER: ${{ github.event.pull_request.number }} |
| 117 | + BODY: > |
| 118 | + Failed to backport PR to `release-2.0` branch. See [logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. |
| 119 | +
|
| 120 | + - name: Report an error if backport unsupported labels |
| 121 | + if: > |
| 122 | + contains(github.event.pull_request.labels.*.name, 'semver:major') |
| 123 | + || contains(github.event.label.name, 'semver:major') |
| 124 | + run: gh pr comment "$NUMBER" --body "$BODY" |
| 125 | + env: |
| 126 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 127 | + GH_REPO: ${{ github.repository }} |
| 128 | + NUMBER: ${{ github.event.pull_request.number }} |
| 129 | + BODY: > |
| 130 | + Label `semver:major` blocks backports to the branch `release-2.0`. |
0 commit comments