Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ on:
jobs:
pull-request:
uses: ./.github/workflows/pull-request.yml
secrets: inherit
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@ This repo contains GitHub Action workflows that can be re-used by other apps.

## Pull request risk labels

Use the shared pull-request workflow to apply an SDLC risk label to every pull request.
Use the shared pull-request workflow to apply an SDLC risk label to every pull request. The calling repository needs access to an `ANTHROPIC_API_KEY` secret. Pass only that secret instead of `secrets: inherit`, so the shared workflow cannot receive unrelated credentials.

```yaml
name: Pull Request

on:
pull_request:
types: [opened, reopened, synchronize]
types: [opened, reopened, synchronize, ready_for_review, labeled]

jobs:
pull-request:
uses: simpleanalytics/github-actions/.github/workflows/pull-request.yml@main
secrets: inherit
with:
internal_app: false
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
```

When a PR has neither SDLC label, Claude reads the full PR diff and returns `change: routine` or `change: needs review` with a one-sentence reason, which the workflow applies and posts once. A `change: needs review` reason links to the lines of the most critical change. Later pushes skip Claude because an existing label is authoritative. If Claude returns no valid label, the workflow uses `change: routine`; if both labels are present, `change: needs review` wins.
On the first run, Claude reads the full PR diff and returns `change: routine` or `change: needs review` with a one-sentence reason. On later pushes, Claude only reads the changes since the last successful assessment, and earlier review triggers stay until a new diff removes them. The workflow posts the reason when the label changes; a `change: needs review` reason links to the lines of the most critical change. A label set by hand is kept as the assessment of the earlier code. If Claude returns an incomplete assessment, the run fails and leaves the labels unchanged.

Draft PRs are skipped until they are ready for review. When a PR gets `change: needs review`, from Claude or by hand, the workflow requests a human reviewer.

The prompt maps the four release risk levels of the Software Release and Deployment Procedure onto the two labels and includes notes per repository. Add a note to the prompt when a repository needs specific guidance.

Set `internal_app: true` for internal apps where changes that do not touch personal data or security should stay `change: routine`. The workflow defaults to `claude-sonnet-5-5`; override it with `claude_model`.
Set `internal_app: true` for an internal app without a repository note, so changes that do not touch personal data or security stay `change: routine`. The workflow defaults to `claude-haiku-5-5`; override it with `claude_model`.

## Deploy

Expand Down
Loading