diff --git a/.github/workflows/dispatch-docs-event.yml b/.github/workflows/dispatch-docs-event.yml deleted file mode 100644 index 9c23a916..00000000 --- a/.github/workflows/dispatch-docs-event.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Dispatch git events to docs vault - -on: - pull_request: - types: [closed] - branches: [main, dev] - release: - types: [published] - workflow_dispatch: - inputs: - type: - description: "Event type" - required: true - default: "manual" - message: - description: "Event message" - required: true - default: "Manual dispatch from monorepo" - -permissions: - contents: read - -jobs: - dispatch: - if: >- - github.event_name != 'pull_request' || - github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Build payload - id: payload - shell: bash - env: - EVENT_NAME: ${{ github.event_name }} - PR_TITLE: ${{ github.event.pull_request.title }} - PR_NUMBER: ${{ github.event.pull_request.number }} - PR_BASE: ${{ github.event.pull_request.base.ref }} - PR_URL: ${{ github.event.pull_request.html_url }} - RELEASE_TAG: ${{ github.event.release.tag_name }} - RELEASE_NAME: ${{ github.event.release.name }} - RELEASE_URL: ${{ github.event.release.html_url }} - MANUAL_TYPE: ${{ github.event.inputs.type }} - MANUAL_MESSAGE: ${{ github.event.inputs.message }} - run: | - set -euo pipefail - case "$EVENT_NAME" in - pull_request) - type="pr-merge-${PR_BASE}" - message="PR #${PR_NUMBER} merged into ${PR_BASE}: ${PR_TITLE} (${PR_URL})" - ;; - release) - type="release" - message="Release ${RELEASE_TAG} — ${RELEASE_NAME} (${RELEASE_URL})" - ;; - workflow_dispatch) - type="${MANUAL_TYPE}" - message="${MANUAL_MESSAGE}" - ;; - *) - type="unknown" - message="Unhandled event: ${EVENT_NAME}" - ;; - esac - { - echo "type=${type}" - echo "message<> "$GITHUB_OUTPUT" - - - name: Trigger decoded-docs repository_dispatch - env: - GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }} - EVENT_TYPE: ${{ steps.payload.outputs.type }} - EVENT_MESSAGE: ${{ steps.payload.outputs.message }} - run: | - set -euo pipefail - payload=$(jq -nc \ - --arg type "$EVENT_TYPE" \ - --arg message "$EVENT_MESSAGE" \ - '{event_type: "git-event", client_payload: {type: $type, message: $message}}') - - if ! gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - /repos/decodedcorp/decoded-docs/dispatches \ - --input - <<<"$payload"; then - echo "::warning::Failed to dispatch git-event to decoded-docs." - exit 0 - fi - - echo "Dispatched git-event (${EVENT_TYPE}) to decoded-docs."