diff --git a/.github/workflows/create-docs-issues.js b/.github/workflows/create-docs-issues.js deleted file mode 100644 index 17fee881034..00000000000 --- a/.github/workflows/create-docs-issues.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = async ({ github, context }) => { - const ISSUE_REPO_NAME = "deephaven-docs-community"; - const ISSUE_TYPES = ["Community"]; - - const body = - `_This issue was auto-generated_\n\n` + - `PR: ${context.payload.pull_request.html_url}\n` + - `Author: ${context.payload.pull_request.user.login}\n\n` + - "## Original PR Body\n\n" + - context.payload.pull_request.body; - - const promises = ISSUE_TYPES.map((type) => - github.rest.issues.create({ - owner: context.repo.owner, - repo: ISSUE_REPO_NAME, - title: `${context.payload.pull_request.title}`, - body, - labels: ["triage", "autogenerated"], - }) - ); - - const issues = await Promise.allSettled(promises); - const issuesLinks = issues.map((promise, i) => { - const type = ISSUE_TYPES[i]; - const { status, value, reason } = promise; - const link = - status === "fulfilled" - ? value.data.html_url - : `Failed to create issue: ${reason}`; - return `${type[0].toUpperCase() + type.slice(1)}: ${link}`; - }); - - await github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: - "Labels indicate documentation is required. Issues for documentation have been opened:\n\n" + - issuesLinks.join("\n"), - }); -}; diff --git a/.github/workflows/create-docs-issues.yml b/.github/workflows/pr-merge-webhook.yml similarity index 58% rename from .github/workflows/create-docs-issues.yml rename to .github/workflows/pr-merge-webhook.yml index 20b147ec4e8..907c890ec66 100644 --- a/.github/workflows/create-docs-issues.yml +++ b/.github/workflows/pr-merge-webhook.yml @@ -1,4 +1,4 @@ -name: Create documentation ticket +name: PR Merge Webhook on: pull_request_target: @@ -9,21 +9,19 @@ on: - closed 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') + jira-webhook-pr-merge: + # 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 + 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/slack-github-action@v2.0.0