GitHub Actions is one implementation of a portable CI model

A portable CI model has the same logic across providers: an event starts a workflow, a job receives a clean runner, checks run, evidence is saved, and a person decides whether to merge.

GitHub Actions is one YAML syntax for that model. The sequence can be adapted to GitLab CI, Jenkins, or Bitbucket Pipelines with different field names.

ConceptRole
WorkflowVersioned YAML automation scenario
EventTrigger such as pull_request to main
JobA unit of work on a runner
StepA command or action inside a job
RunnerTemporary standardized environment
ArtifactFile saved after a job for review

Minimal PR workflow

A workflow should pass ordinary Git review. Start with contents: read and add permissions only when a specific step requires them.

.github/workflows/pr-check.yml
name: PR verification

on:
  pull_request:
    branches: [main]

permissions:
  contents: read

jobs:
  verify:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
      # setup runtime, build, and tests are added below

Claude in CI as a bounded analyzer

  1. Prepare one input file: diff, build log, or test log.
  2. Pass only that input and a narrow prompt.
  3. Request structured Markdown or JSON without code edits.
  4. Save the result as a workflow artifact.
  5. Review the conclusion with the original log before deciding.
Illustrative bounded analysis step
- name: Prepare diff
  run: git show --stat --patch --format=medium HEAD > pr.diff

- name: Analyze changes
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  run: |
    cat pr.diff | claude -p "Summarize the changes and three possible risks" > pr-review.md

Secrets, artifacts, and timeouts

  • Store API keys in the CI provider secret store.
  • Do not print secrets in prompts, logs, or uploaded artifacts.
  • Limit jobs with an explicit timeout.
  • Use pull-requests: write only for an intentional automated PR comment.
  • Upload only the Markdown, JSON, or failure-log files that are needed.
Save a review result as an artifact
- name: Upload review
  uses: actions/upload-artifact@v4
  with:
    name: pr-review
    path: pr-review.md

Portable workflow checklist

QuestionWhat must be explicit
What starts the pipeline?Event and target branch
Where does the job run?Runner and runtime setup
Which permissions are available?Workflow or job permissions
Which commands are authoritative?README and local scripts
What is saved?Logs and required artifacts
Who decides?A person or branch policy, not Claude alone

Canonical lesson source · JavaRush

Open JavaRush material