fa4ee68c6a
Instead of attempting to pick each individual commit in a PR using `BACKPORT_MERGE_COMMIT` only picks the commit that was merged into `main`. This reduces the amount of work done during a backport, generating cleaner merges and avoiding potential issues on specific commits. With this setting PRs that are not squashed will fail to backport and must be handled manually, but those are considered exceptions.
72 lines
2.5 KiB
YAML
72 lines
2.5 KiB
YAML
---
|
|
name: Backport Assistant Runner
|
|
|
|
on:
|
|
pull_request_target:
|
|
types:
|
|
- closed
|
|
- labeled
|
|
|
|
jobs:
|
|
backport:
|
|
if: github.event.pull_request.merged
|
|
runs-on: ubuntu-latest
|
|
container: hashicorpdev/backport-assistant:0.2.3
|
|
steps:
|
|
- name: Backport changes to stable-website
|
|
run: |
|
|
backport-assistant backport -merge-method=squash -automerge
|
|
env:
|
|
BACKPORT_LABEL_REGEXP: "backport/(?P<target>website)"
|
|
BACKPORT_TARGET_TEMPLATE: "stable-{{.target}}"
|
|
BACKPORT_MERGE_COMMIT: true
|
|
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
- name: Backport changes to targeted release branch
|
|
run: |
|
|
backport-assistant backport -merge-method=squash -automerge
|
|
env:
|
|
BACKPORT_LABEL_REGEXP: "backport/(?P<target>\\d+\\.\\d+\\.[+\\w]+)"
|
|
BACKPORT_TARGET_TEMPLATE: "release/{{.target}}"
|
|
BACKPORT_MERGE_COMMIT: true
|
|
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
handle-failure:
|
|
needs:
|
|
- backport
|
|
if: always() && needs.backport.result == 'failure'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Send slack notification on failure
|
|
uses: slackapi/slack-github-action@v1.23.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"text": ":x::arrow_right_hook::nomad-sob: Backport run *FAILED*",
|
|
"attachments": [
|
|
{
|
|
"color": "#C41E3A",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"fields": [
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*Pull Request:*\n<${{ github.event.pull_request.html_url}}|${{ github.repository }}#${{ github.event.pull_request.number}}>"
|
|
},
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*From:*\n@${{ github.event.sender.login }}"
|
|
},
|
|
{
|
|
"type": "mrkdwn",
|
|
"text": "*Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_ASSISTANT_FAILURE_SLACK }}
|
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|