diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index a934505..17e5842 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -7,4 +7,5 @@ on: jobs: pull-request: uses: ./.github/workflows/pull-request.yml - secrets: inherit + secrets: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} diff --git a/README.md b/README.md index d1aa836..edb30cf 100644 --- a/README.md +++ b/README.md @@ -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