Backport of chore(variable): Go stdlib vars for HTTP methods and status codes into release/1.4.x #8699
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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}}" | |
# Enabling this option increased the number of backport failures. | |
BACKPORT_MERGE_COMMIT: false | |
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}}" | |
# Enabling this option increased the number of backport failures. | |
BACKPORT_MERGE_COMMIT: false | |
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
handle-failure: | |
needs: | |
- backport | |
if: always() && needs.backport.result == 'failure' | |
runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }} | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- uses: ./.github/actions/vault-secrets | |
with: | |
paths: |- | |
kv/data/teams/nomad/slack-webhooks feed-nomad | SLACK_FEED_NOMAD ; | |
- name: Send slack notification on failure | |
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # 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: ${{ env.SLACK_FEED_NOMAD || secrets.BACKPORT_ASSISTANT_FAILURE_SLACK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
permissions: | |
contents: read | |
id-token: write |