Skip to content

Commit 8efe686

Browse files
committed
feat(release_hook): Add webhook on merge from release to master
Passes release version and directed to github api
1 parent 3bb16bf commit 8efe686

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/hook.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release Merged Hook
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- master
8+
9+
jobs:
10+
trigger-dispatch:
11+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Extract Version from Branch Name
15+
id: version-extract
16+
run: echo "version=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
17+
shell: bash
18+
19+
- name: Trigger Repository Dispatch Event
20+
env:
21+
VERSION: ${{ env.version }}
22+
run: |
23+
VERSION=${VERSION#"release/"}
24+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
25+
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
26+
"https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches" \
27+
-d "{\"event_type\":\"release_merged\", \"client_payload\": {\"version\":\"${VERSION}\"}}"
28+

0 commit comments

Comments
 (0)