Secure GitHub Actions CI pipeline with caching and least privilege

par fidji ChatGPT Anglais ~678 tokens
Extrait public Verrouillé
Job graph (lint → test matrix → build → audit), cache keyed on the lockfile hash, concurrency group that cancels outdated runs, permissions: contents: read at the top, third-party actions pinned to a full SHA, untrusted event fields passed through env, never pull_request_target with checkout…

À propos de ce prompt

Generates a commented GitHub Actions workflow for your stack: lint, tests with service containers, build, dependency audit, with lockfile-keyed caching, concurrency cancellation and path filters. Security is built in: read-only token by default, actions pinned to commit SHAs, no secrets on fork PRs, OIDC for cloud access, no script injection from event data.

Exemple de résultat

Fourni par l'auteur
```yaml name: ci on: pull_request: push: branches: [main] permissions: contents: read # read-only token by default concurrency: group: ci-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: test: runs-on: ubuntu-latest timeout-minutes: 15 strategy: matrix: { node: [20, 22] } services: postgres: image: postgres:16 env: { POSTGRES_PASSWORD: test } ports: ['5432:5432'] options: --health-cmd pg_isready --health-interval 5s steps: - uses: actions/checkout@<FULL_COMMIT_SHA> # v4 - uses: pnpm/action-setup@<FULL_COMMIT_SHA> # v4 - uses: actions/setup-node@<FULL_COMMIT_SHA> # v4 with: { node-version: '${{ matrix.node }}', cache: pnpm } - run: pnpm install --frozen-lockfile - run: pnpm test env: { DATABASE_URL: 'postgres://postgres:test@localhost:5432/postgres' } ``` Resolve SHAs: open the action's release page, copy the commit of the tag, keep the tag in the comment…

Fiche technique

Modèle
ChatGPT
Langue du prompt
Anglais
Pour qui
Developers and DevOps engineers setting up or cleaning up CI on GitHub for an app or library
Longueur
~678 tokens (estimation)
Format livré
Texte du prompt, affiché en ligne après achat

Avis

Réservés aux acheteurs

Aucun avis pour l'instant. Seuls les acheteurs de ce prompt peuvent en laisser un.

Signaler ce prompt