dkamm/pr-quiz
关于
A GitHub Action that uses AI to generate a quiz from your pull request
人工智能与机器学习实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文PR Quiz
Intro
AI Agents are starting to write more code. How do we make sure we understand what they're writing?
PR Quiz is a GitHub Action that uses AI to generate a quiz based on a pull request. It can help you, the human reviewer, test your understanding of your AI Agent's code. (And block you from deploying code you don't understand!)

Getting started
- Make sure you have an OpenAI API Key and an ngrok auth token (free tier works).*
- Add the OpenAI API Key and ngrok auth token as action secrets to your
repository (
settings -> secrets -> actionsin the UI) - Add the following
quiz.ymlto your.github/workflowsdirectory
# quiz.yml
name: PR Quiz
on:
pull_request_review:
types: [submitted]
permissions:
contents: read
pull-requests: read
jobs:
quiz:
name: PR Quiz
runs-on: ubuntu-latest
environment: your-environment # TODO: change this to your actual environment
# Only trigger on approvals to save tokens
if: github.event.review.state == 'approved'
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Serve Quiz
id: serve-quiz
uses: dkamm/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
ngrok-authtoken: ${{ secrets.NGROK_AUTHTOKEN }}
*The PR Quiz action creates a temporary webserver inside the GitHub Actions runner and uses ngrok to create a public tunnel to it
Inputs
| Name | Description | Default Value | Required |
|---|---|---|---|
| github-token | GitHub token for API access | - | Yes |
| ngrok-authtoken | The ngrok authtoken to use for the server hosting the quiz. | - | Yes |
| openai-api-key | OpenAI API key for API access | - | Yes |
| model | The model to use for generating the quiz. It must be a model that supports structured outputs. | o4-mini |
No |
| lines-changed-threshold | The minimum number of lines changed required to create a quiz. This is to prevent quizzes from being created for small pull requests. | 100 |
No |
| time-limit-minutes | The time limit to complete the quiz in minutes. This prevents the action from running indefinitely. | 10 |
No |
| max-attempts | The maximum number of attempts to pass the quiz. A value of 0 means unlimited attempts. | 3 |
No |
| exclude-file-patterns | A list of file patterns to exclude from the quiz as a JSON-ified string. | '["**/*-lock.json", "**/*-lock.yaml", "**/*.lock", "**/*.map", "**/*.pb.*", "**/*_pb2.py", "**/*.generated.*", "**/*.auto.*"]' |
No |
| system-prompt | Optional override for the system prompt. Be sure the specify that multiple choice questions must be returned. | See here for the default system prompt | No |
Privacy
Because this action runs a temporary webserver inside the GitHub Actions runner, your code isn't sent to any third party other than the model provider (OpenAI). This action can be easily modified to work with self-hosted models as well.
探索相关项目
加载中…