diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml new file mode 100644 index 000000000..8b5b063cb --- /dev/null +++ b/.github/workflows/dispatch.yml @@ -0,0 +1,40 @@ +name: Trigger documentation rebuild + +on: + # Runs on pushes targeting the default branch + push: + branches: [main] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Default to bash +defaults: + run: + shell: bash + +jobs: + # Build job + dispatch: + runs-on: ubuntu-latest + permissions: + contents: write # needed for triggering dispatch + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: "coraza,coraza.io" + + - name: Dispatch to workflows + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ steps.app-token.outputs.token }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + --data '{"event_type": "documentation", "client_payload": { "sha": "${{ github.sha }}"}}' \ + "https://api.github.com/repos/$GITHUB_REPOSITORY_OWNER/coraza.io/dispatches"