RousselTMLEARNING

Article · GitHub Actions: from discovery to expertise

Reusing and securing

1. Reusing #

One pipeline shared by every team.

The levels #

Reuse
# .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 #

RiskMitigation
Over-powered tokenpermissions: contents: read at workflow level, wider rights job by job
Compromised action (moved tag)pin by full SHA: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
Script injectionnever insert ${{ github.event.pull_request.title }} in run: go through an env variable
pull_request_targetruns with secrets on the fork's code: never check out the PR branch there
Outdated dependenciesDependabot 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 SHA
  • gh secret set API_KEY --env production : environment secret
  • gh 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.

📄 Reusing and securing GitHub Actions workflows →

My progress

  • ⏱ Estimated time : ≈ 5 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

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,...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!