fix(kds): fix the case when webhook/db reject resource (backport of #10315) #5467
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: "Notify about updates to Kuma" | |
on: | |
push: | |
tags: | |
- '*' | |
pull_request_target: | |
types: [closed] | |
branches: | |
- master | |
- release-* | |
permissions: | |
contents: read | |
jobs: | |
notify-about-merged-pr: | |
if: github.event_name != 'pull_request_target' || github.event.pull_request.merged | |
name: "Notify about merged PR" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Send repository dispatch event" | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.NOTIFY_BOT_PAT_TOKEN }} | |
script: | | |
let branch, pr; | |
if (context.eventName == "pull_request_target") { | |
branch = context.payload.pull_request.base.ref; | |
pr = context.payload.pull_request.number; | |
} else if (context.eventName == "push") { | |
const versionRegex = /v?(\d+)\.(\d+)\.\d+/; | |
const versionMatch = process.env.GITHUB_REF_NAME.match(versionRegex); | |
if (!versionMatch) { | |
return; | |
} | |
const [_, major, minor] = [...versionMatch]; | |
branch = `release-${major}.${minor}`; | |
} | |
return github.rest.repos.createDispatchEvent({ | |
owner: '${{ secrets.NOTIFY_OWNER }}', | |
repo: '${{ secrets.NOTIFY_REPO }}', | |
event_type: '${{ secrets.NOTIFY_EVENT_TYPE }}', | |
client_payload: { | |
branch, | |
pr, | |
}, | |
}); |