diff --git a/.github/workflows/git-commands.yaml b/.github/workflows/git-commands.yaml index 6e44067283..b9602d122e 100644 --- a/.github/workflows/git-commands.yaml +++ b/.github/workflows/git-commands.yaml @@ -283,3 +283,34 @@ jobs: repo: context.repo.repo, body: 'Successfully updated ee-repo-ref.txt' }) + + update-docs: + if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/docs') + runs-on: ubicloud-standard-2 + permissions: + contents: read + pull-requests: read + issues: read + steps: + - uses: actions/create-github-app-token@v2 + id: app + with: + app-id: ${{ vars.INTERNAL_APP_ID }} + private-key: ${{ secrets.INTERNAL_APP_KEY }} + owner: ${{ github.repository_owner }} + repositories: | + windmilldocs + + - name: Trigger docs update + env: + GH_TOKEN: ${{ steps.app.outputs.token }} + COMMENT_TEXT: ${{ github.event.comment.body }} + run: | + jq -n \ + --argjson pr_number ${{ github.event.issue.number }} \ + --arg repo "${{ github.event.repository.name }}" \ + --arg comment "$COMMENT_TEXT" \ + '{event_type: "create-docs", client_payload: {pr_number: $pr_number, repo: $repo, comment_text: $comment}}' | \ + gh api repos/windmill-labs/windmilldocs/dispatches \ + --method POST \ + --input -