Update webhook trigger for feat PRs

This commit is contained in:
Ligia Zanchet
2026-03-16 14:38:31 +01:00
committed by GitHub
parent a17a5de954
commit 23c8e5c745
+26 -17
View File
@@ -1,26 +1,35 @@
name: Documentation Webhook on trigger on Feat PRs
name: Trigger webhook for feat PRs
on:
pull_request:
types: [closed]
branches:
- main
jobs:
webhook:
# Only run if the PR was merged AND the head branch name contains 'feat'
if: github.event.pull_request.merged == true && contains(github.event.pull_request.head.ref, 'feat')
call-webhook:
if: >
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.title, 'feat:')
runs-on: ubuntu-latest
steps:
- name: Send Webhook
- name: Send webhook safely
run: |
curl -X POST ${{ secrets.DOC_WEBHOOK_URL }} \
-H "Content-Type: application/json" \
-d '{
"repo": "${{ github.repository }}",
"pr_number": "${{ github.event.pull_request.number }}",
"title": "${{ github.event.pull_request.title }}",
"description": "${{ github.event.pull_request.body }}",
"author": "${{ github.event.pull_request.user.login }}",
"merged_at": "${{ github.event.pull_request.merged_at }}"
}'
payload=$(jq -n \
--arg repo "${GITHUB_REPOSITORY}" \
--arg pr_number "${{ github.event.pull_request.number }}" \
--arg title "${{ github.event.pull_request.title }}" \
--arg body "${{ github.event.pull_request.body }}" \
--arg author "${{ github.event.pull_request.user.login }}" \
--arg merged_at "${{ github.event.pull_request.merged_at }}" \
'{
repo: $repo,
pr_number: $pr_number,
title: $title,
description: $body,
author: $author,
merged_at: $merged_at
}'
)
curl --fail-with-body -X POST "${{ secrets.DOC_WEBHOOK_URL }}" \
-H "Content-Type: application/json" \
--data-raw "$payload"