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.
| Concept | Role |
|---|---|
| Workflow | Versioned YAML automation scenario |
| Event | Trigger such as pull_request to main |
| Job | A unit of work on a runner |
| Step | A command or action inside a job |
| Runner | Temporary standardized environment |
| Artifact | File 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.
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 belowClaude in CI as a bounded analyzer
- Prepare one input file: diff, build log, or test log.
- Pass only that input and a narrow prompt.
- Request structured Markdown or JSON without code edits.
- Save the result as a workflow artifact.
- Review the conclusion with the original log before deciding.
- 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.mdSecrets, 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.
- name: Upload review
uses: actions/upload-artifact@v4
with:
name: pr-review
path: pr-review.mdPortable workflow checklist
| Question | What 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