diff --git a/.github/workflows/hook.yml b/.github/workflows/hook.yml deleted file mode 100644 index dea799d5..00000000 --- a/.github/workflows/hook.yml +++ /dev/null @@ -1,28 +0,0 @@ -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}\"}}" - diff --git a/.github/workflows/merge_hook.yml b/.github/workflows/merge_hook.yml new file mode 100644 index 00000000..a26393c4 --- /dev/null +++ b/.github/workflows/merge_hook.yml @@ -0,0 +1,43 @@ + +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: | + VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's|release/v||') + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Trigger Repository Dispatch Event + env: + VERSION: ${{ env.VERSION }} + run: | + curl -X POST -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${{ secrets.REPO_ACCESS }}" \ + "https://api.github.com/repos/KiraCore/sekin/dispatches" \ + -d @- <