Trigger prompt PRs from GitHub issue creation
This document explains what (if anything) must be configured in each target repository so Alakai can react to issues.opened and create a prompt PR.
Recommended setup: GitHub App webhook
If Alakai receives GitHub webhooks directly from a GitHub App, there is usually no code or workflow file to add in the target repository.
Required:
- The GitHub App is installed on the target repository.
- The GitHub App subscribes to the
Issuesevent. - The webhook URL points to Alakai:
POST /github/webhook. - The webhook secret matches Alakai
GITHUB_WEBHOOK_SECRET. - In Alakai
config.json, the application is enabled:
{
"projects": {
"my-project": {
"applications": {
"my-app": {
"repo": "my-org/my-repo",
"workflows": {
"githubIssuePromptPr": true
}
}
}
}
}
}
Optional setup: forward events from GitHub Actions
Use this only when direct GitHub App webhooks are not available.
name: Forward issues opened to Alakai
on:
issues:
types: [opened]
jobs:
forward:
runs-on: ubuntu-latest
steps:
- name: Build payload
id: payload
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
REPO_FULL_NAME: ${{ github.repository }}
run: |
payload="$(node -e 'console.log(JSON.stringify({
action: "opened",
repository: { full_name: process.env.REPO_FULL_NAME },
issue: {
number: Number(process.env.ISSUE_NUMBER),
title: process.env.ISSUE_TITLE || "",
body: process.env.ISSUE_BODY || ""
}
}))')"
printf 'payload=%s\n' "$payload" >> "$GITHUB_OUTPUT"
- name: Sign payload
id: sign
env:
PAYLOAD: ${{ steps.payload.outputs.payload }}
GITHUB_WEBHOOK_SECRET: ${{ secrets.GITHUB_WEBHOOK_SECRET }}
run: |
digest="$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$GITHUB_WEBHOOK_SECRET" -hex | sed 's/^.* //')"
printf 'signature=sha256=%s\n' "$digest" >> "$GITHUB_OUTPUT"
- name: Send to Alakai
env:
PAYLOAD: ${{ steps.payload.outputs.payload }}
SIGNATURE: ${{ steps.sign.outputs.signature }}
ALAKAI_WEBHOOK_URL: ${{ secrets.ALAKAI_WEBHOOK_URL }}
run: |
curl -sS -X POST "$ALAKAI_WEBHOOK_URL" \
-H "content-type: application/json" \
-H "x-github-event: issues" \
-H "x-hub-signature-256: $SIGNATURE" \
--data "$PAYLOAD"
Required repository secrets for forwarding mode:
GITHUB_WEBHOOK_SECRET(same value configured in Alakai)ALAKAI_WEBHOOK_URL(for examplehttps://alakai.example.com/github/webhook)