1. Reusing #
One pipeline shared by every team.
The levels #
# .github/workflows/python-ci.yml (in a shared repository)
on:
workflow_call:
inputs:
python-version: { type: string, default: "3.12" }
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with: { python-version: "${{ inputs.python-version }}", cache: pip }
- run: pip install -r requirements-dev.txt && pytest
# in a consuming repository
jobs:
ci:
uses: my-org/shared-ci/.github/workflows/python-ci.yml@v1.4.0
with: { python-version: "3.13" }2. Securing #
The CI chain is a target.
The rules #
| Risk | Mitigation |
|---|---|
| Over-powered token | permissions: contents: read at workflow level, wider rights job by job |
| Compromised action (moved tag) | pin by full SHA: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| Script injection | never insert ${{ github.event.pull_request.title }} in run: go through an env variable |
| pull_request_target | runs with secrets on the fork's code: never check out the PR branch there |
| Outdated dependencies | Dependabot for the github-actions ecosystem |
- name: Print the title (safe)
env:
TITLE: ${{ github.event.pull_request.title }}
run: echo "Title: $TITLE"Good to know : CodeQL (code scanning), secret scanning with push protection and repository rules (rulesets, required checks) complete security; on private repositories, they belong to GitHub Advanced Security.
Commands to know #
Commands to know
gh api repos/actions/checkout/git/ref/tags/v7.0.1 --jq .object.sha: find an action tag's SHAgh secret set API_KEY --env production: environment secretgh api repos/{owner}/{repo}/code-scanning/alerts: CodeQL alerts
Sources #
Checked in November 2026: CI/CD platforms change every month, check versions and plans in the vendor's documentation.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Reusing and securing GitLab pipelines
Industrializing GitLab CI/CD: extends, anchors and !reference, include, CI/CD components and cata...
Writing GitHub Actions workflows
Mastering workflow syntax: triggers and filters, jobs and needs, matrices, if conditions, context...
End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice
Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...
GitHub Actions: concepts and how it works
Discover GitHub Actions: events, workflows, jobs, steps and actions, the Marketplace, hosted runn...
GitHub Actions best practices and troubleshooting
Running GitHub Actions: speeding up and cutting costs, debugging (debug logs, act locally, gh run...
GitHub Actions runners: hosted, self-hosted and ARC
Choosing where workflows run: hosted runners and images, larger runners, self-hosted runners (ins...
Delivering with GitHub Actions: GHCR, environments, OIDC and attestations
Building and deploying with GitHub Actions: publishing an image to GitHub Container Registry with...
Container registry: choosing and securing your image registry (Docker Hub, Harbor, GHCR, ECR)
Understand container registries: Docker Hub, GitHub Container Registry, cloud registries (ECR, AC...
DevSecOps: securing the software supply chain end to end
Integrate security into the DevOps pipeline: shift-left, threat modeling, secret detection, SAST,...