From 3d9f68461e87a86f7159a7c6fb55d77024fab5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B6rg=C3=A6sis?= Date: Wed, 27 May 2026 12:43:15 +0000 Subject: [PATCH] feat: add reviewer github action --- README.md | 28 ++++++++++++++++++++++++ action.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 action.yml diff --git a/README.md b/README.md index 0161099..cfe1577 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,34 @@ not contain review logic. ## Usage +GitHub Actions: + +```yaml +name: Postil review + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + pull-requests: write + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: postil-dev/postil-reviewer@main + with: + api-key: ${{ secrets.OPENROUTER_API_KEY }} +``` + +The Action installs the `postil` binary from this repository revision, then runs +`postil review` against the pull request. + +Local CLI: + ```bash postil review --repo owner/repo --pr 123 --sha HEAD_SHA ``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6ac6193 --- /dev/null +++ b/action.yml @@ -0,0 +1,63 @@ +name: 'Postil AI Review' +description: 'AI pull-request reviewer for serious teams, open-source, zero-infra, fully auditable.' +author: 'Postil' +branding: + icon: 'git-pull-request' + color: 'blue' + +inputs: + api-key: + description: 'OpenRouter API key' + required: true + model: + description: 'OpenRouter model name' + required: false + default: 'moonshotai/kimi-k2.6' + fail-on: + description: 'Exit 1 when a finding meets this severity: info, warn, or error' + required: false + default: 'error' + no-inline: + description: 'Skip posting inline PR review comments' + required: false + default: 'false' + config-path: + description: 'Optional path to a configuration file' + required: false + github-token: + description: 'GitHub token for posting review comments' + required: false + default: '${{ github.token }}' + +runs: + using: 'composite' + steps: + - name: Install Postil reviewer + shell: bash + run: cargo install --path "$GITHUB_ACTION_PATH" --locked --force + - name: Run Postil review + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github-token }} + OPENROUTER_API_KEY: ${{ inputs.api-key }} + REVIEW_MODEL: ${{ inputs.model }} + POSTIL_FAIL_ON: ${{ inputs.fail-on }} + POSTIL_CONFIG_PATH: ${{ inputs.config-path }} + POSTIL_NO_INLINE: ${{ inputs.no-inline }} + run: | + args=(review) + if [[ -n "$POSTIL_CONFIG_PATH" ]]; then + args+=(--config "$POSTIL_CONFIG_PATH") + fi + case "$POSTIL_NO_INLINE" in + true) + args+=(--no-inline) + ;; + false|"") + ;; + *) + echo "::error::no-inline must be 'true' or 'false'" + exit 1 + ;; + esac + postil "${args[@]}"