-
Notifications
You must be signed in to change notification settings - Fork 337
39 lines (39 loc) · 1.24 KB
/
pr-merged.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: "Notify about updates to Kuma"
on:
push:
tags:
- '*'
branches:
- master
- release-*
permissions:
contents: read
jobs:
notify-about-merged-pr:
timeout-minutes: 10
name: "Notify about merged PR"
runs-on: ubuntu-24.04
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 = process.env.GITHUB_REF_NAME;
if (process.env.GITHUB_REF_TYPE === "tag") {
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,
},
});