GitHub Action
GitHub Action
Add a Turing Test to every pull request automatically. The action generates questions from the diff, posts a quiz link as a PR comment, and updates the commit status after the author answers — no prs.md account required for setup.
How it works
- PR opened or updated — the action fetches the diff and generates 3 targeted questions, one of which is a hallucination trap.
- Quiz link posted as a PR comment; commit status set to pending.
- PR author takes the timed quiz on prs.md (3 minutes, no copy-paste).
- Action grades answers and updates the commit status to pass or fail.
Step 1 — Add repo secrets
Go to your repo → Settings → Secrets and variables → Actions → New repository secret and add these three secrets:
| Secret | Value |
|---|---|
| PRS_API_KEY | Your LLM API key (OpenAI, Anthropic, or Gemini) |
| PRS_PROVIDER | openai, anthropic, or gemini |
| PRS_CALLBACK_TOKEN | GitHub fine-grained PAT (see below) |
Creating PRS_CALLBACK_TOKEN
The callback token lets prs.md notify the action when a quiz is completed via a repository_dispatch event. It only needs write access to trigger that event.
- Go to github.com/settings/personal-access-tokens/new
- Select Fine-grained token
- Repository access → Only select repositories → pick your repo
- Permissions → Contents → Read and write
- Generate the token, copy it, and add it as
PRS_CALLBACK_TOKEN
Step 2 — Add the workflow file
Create .github/workflows/prs-md.yml in your repository:
name: "PRs.md Turing Test"
on:
pull_request:
types: [opened, synchronize]
repository_dispatch:
types: [prs-md-quiz-submitted]
permissions:
statuses: write
pull-requests: write
jobs:
prs-md:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prs-md/action@v1
with:
prs-api-key: ${{ secrets.PRS_API_KEY }}
prs-provider: ${{ secrets.PRS_PROVIDER }}
prs-callback-token: ${{ secrets.PRS_CALLBACK_TOKEN }}Step 3 — Open a PR
That's it. Open or update a pull request and the action will run automatically. The PR author receives a comment with a quiz link, takes the timed quiz on prs.md, and the commit status updates to pass or fail once graded.
Inputs reference
| Input | Required | Description |
|---|---|---|
| prs-api-key | Yes | LLM API key (OpenAI, Anthropic, or Gemini) |
| prs-provider | Yes | openai, anthropic, or gemini (default: openai) |
| prs-callback-token | Yes | GitHub PAT for dispatching the quiz-submitted event |
| prs-server-url | No | Override API base URL (default: https://prs.md). Useful for self-hosted instances. |