Skip to content

Commit

Permalink
ci: Invoke webhook on PR merge
Browse files Browse the repository at this point in the history
- This gives us flexibility to create a docs issue from Jira or react differently depending on the PR merge data
- Creating issues in the docs repo is deprecated
- Tested webhook with data in a test repo to ensure PR data could be used correctly
  • Loading branch information
mofojed committed Feb 3, 2025
1 parent 54844a9 commit 17e8abf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 52 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/create-docs-issues.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create documentation ticket
name: PR Merge Webhook

on:
pull_request_target:
Expand All @@ -10,20 +10,19 @@ on:

jobs:
create-docs-ticket:
# Only on merged PRs that contain the DocumentationNeeded flag
if: github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'DocumentationNeeded')
# Only on merged PRs
if: github.event.pull_request.merged
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Create Issues
id: create-issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DOCS_ISSUES_PAT }}
script: |
const script = require('.github/workflows/create-docs-issues.js');
await script({github, context});
- name: Trigger PR Merge Webhook
id: trigger-pr-merge-webhook
env:
# Push the PR details in the webhook data.
WEBHOOK_DATA: ${{ toJSON(github.event.pull_request) }}
run: |
curl -X POST -H 'X-Automation-Webhook-Token: ${{ secrets.JIRA_WEBHOOK_SECRET_PR_MERGE }}' -H "Content-Type: application/json" --data "$WEBHOOK_DATA" ${{ secrets.JIRA_WEBHOOK_URL_PR_MERGE }}
- name: Slack Failure Message
uses: slackapi/[email protected]
Expand Down

0 comments on commit 17e8abf

Please sign in to comment.