Skip to content

Commit

Permalink
feat(release_hook): Add webhook on merge from release to master
Browse files Browse the repository at this point in the history
Passes release version and directed to github api
  • Loading branch information
MrLutik committed Mar 1, 2024
1 parent 3bb16bf commit 8efe686
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/hook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release Merged Hook

on:
pull_request:
types: [closed]
branches:
- master

jobs:
trigger-dispatch:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
runs-on: ubuntu-latest
steps:
- name: Extract Version from Branch Name
id: version-extract
run: echo "version=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
shell: bash

- name: Trigger Repository Dispatch Event
env:
VERSION: ${{ env.version }}
run: |
VERSION=${VERSION#"release/"}
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
"https://api.github.com/repos/${{ secrets.DISPATCH_OWNER }}/${{ secrets.DISPATCH_REPO }}/dispatches" \
-d "{\"event_type\":\"release_merged\", \"client_payload\": {\"version\":\"${VERSION}\"}}"

0 comments on commit 8efe686

Please sign in to comment.