Forecast scalability problems caused by code changes before they reach production.
- π Highlights risky database operations, heavy loops, and new endpoints as soon as a pull request opens.
- π€ Uses OpenAI (defaults to
gpt-4o) to simulate realistic load profiles without staging infrastructure. - π Produces reviewer-ready Markdown with predicted bottlenecks, thresholds, and recommended fixes.
- π§° Fits TypeScript/Next.js stacks out of the box and adapts easily to other backends.
Scale Sentry AI turns raw diffs into a deploy-ready performance assessment.
- π₯ Fetch the pull request diff via the GitHub API.
- π¨ Run heuristics to spotlight hotspots (database calls, external requests, CPU loops, concurrency, etc.).
- π§ Craft a prompt that blends signals, traffic assumptions, and diff context.
- βοΈ Call the OpenAI chat completions API for a structured analysis.
- π¬ Publish the Markdown report and expose it as an action output.
flowchart TD
A[Pull Request Trigger] --> B[Checkout Repository]
B --> C[Fetch Diff & Run Heuristics]
C --> D[Build Prompt with Signals]
D --> E[Call OpenAI Chat Completions]
E --> F[Generate Scalability Report]
F --> G[Publish PR Comment / Job Summary]
F --> H[Expose report output for downstream jobs]
name: Scalability Simulator
on:
push:
branches:
- main
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: write
steps:
- uses: actions/checkout@v4
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
target-language: TypeScript
traffic-profile: 1k-100k requests per second- β
Commit the bundled
dist/output and tag a release (for examplegit tag v1 && git push origin v1). - π¦ Consumers reference the tag in their workflow:
- name: Run Scale Sentry AI uses: dextel2/scale-sentry-ai@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} openai-api-key: ${{ secrets.OPENAI_API_KEY }} target-language: TypeScript traffic-profile: 1k-100k requests per second
- π Remind adopters to add an
OPENAI_API_KEYrepository secret and confirm the GitHub token can post comments.
| Input | Required | Default | What It Controls |
|---|---|---|---|
github-token |
yes | - | Authorisation for GitHub API calls and optional PR commenting. |
openai-api-key |
yes | - | Secret used to call the OpenAI chat completions endpoint. |
openai-model |
no | gpt-4o |
Which OpenAI model to query (for example gpt-4o-mini for cheaper runs). |
openai-max-tokens |
no | 900 |
Completion budget; reduce to control spend. |
openai-temperature |
no | 0.2 |
Creativity vs. determinism balance for the model response. |
target-language |
no | TypeScript |
Hint about your codebase to steer the analysis tone. |
traffic-profile |
no | 1k-100k requests per second |
Desired load envelope for simulation commentary. |
post-comment |
no | true |
Disable to skip PR comments and consume outputs only. |
write-job-summary |
no | true |
Disable to prevent adding the report to the job summary. |
| Name | Description |
|---|---|
report |
Markdown body generated by the AI analysis |
- Open Settings -> Developer settings -> Personal access tokens -> Tokens (classic).
- Click Generate new token, name it (for example
scale-sentry-ai), and set an expiry. - Grant
reposcope (orpublic_repofor public repositories). Addworkflowif the action must trigger other workflows. - Generate the token and copy it immediately; GitHub will not show it again.
- Create or reuse a repository secret named
GITHUB_TOKENif you need custom permissions. - Pass the secret into the workflow (
github-token: ${{ secrets.GITHUB_TOKEN }}).
Most scenarios work with GitHub's automatically provided
${{ secrets.GITHUB_TOKEN }}. Create a personal token only when you need elevated privileges (cross-fork commenting, triggering workflows, accessing private repositories, etc.).
- βοΈ Diffs are truncated to 12,000 characters; the report explicitly flags when truncation happens.
- π― Heuristics are intentionally opinionatedβtune
HEURISTIC_CHECKSinsrc/index.tsfor your stack. - π The Markdown output is designed for downstream automation (Slack messages, Jira tickets, dashboards, etc.).
- π¦ Install dependencies with
npm install. - π Build the action via
npm run build(bundled output lands indist/). - π Use
npm run build -- --watchduring active editing. - β
Extend tests or heuristics and re-run
npm testbefore committing.
- π Never commit secretsβstore them in repository or organisation secrets and rotate regularly.
- πΈ Cap
openai-max-tokensor usegpt-4o-minito control OpenAI spend. - π
Set
post-comment: "false"if your review process requires manual approval before commenting. - π§Ύ Logs intentionally omit diff content and OpenAI payloads to avoid leaking sensitive data.
- 𧬠Fork for other ecosystems (Python, Go, JVM) with stack-specific heuristics.
- π Feed real load-test telemetry into the prompt for hybrid AI plus empirical reports.
- π€ Open issues or pull requests with new heuristics so the community benefits.
Ready to ship? Commit dist/, tag a release, and let Scale Sentry AI guard your deploy runway.