diff --git a/.github/workflows/build-hash-router.yml b/.github/workflows/build-hash-router.yml index f26291d5afe4..8b24d57cb152 100644 --- a/.github/workflows/build-hash-router.yml +++ b/.github/workflows/build-hash-router.yml @@ -10,6 +10,7 @@ on: paths: - packages/** - .github/workflows/build-hash-router.yml + - .github/actions/** concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -31,19 +32,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm, Node.js and dependencies + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - name: Set up Node - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true - - name: Installation - run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile + # Security: prevents cache poisoning, as this workflow can write to the repository (GitHub Pages deployment) + cache: false - name: Build Hash Router run: pnpm build:website:fast diff --git a/.github/workflows/build-perf.yml b/.github/workflows/build-perf.yml index 4faca426868f..d6b4a14e81ee 100644 --- a/.github/workflows/build-perf.yml +++ b/.github/workflows/build-perf.yml @@ -47,17 +47,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm and Node.js + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps + # Security: prevents cache poisoning, as this job can write to pull requests, issues and checks + cache: false + # compressed-size-action installs the dependencies of each branch install: false - node-version-file: false - - name: Set up Node - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true - name: Track build size changes uses: preactjs/compressed-size-action@f322c295dde06a1cb7ccaef105732dd8a726d1d9 # v2.10.0 with: diff --git a/.github/workflows/continuous-releases.yml b/.github/workflows/continuous-releases.yml index 9d29d9631dd3..6bb284230f4b 100644 --- a/.github/workflows/continuous-releases.yml +++ b/.github/workflows/continuous-releases.yml @@ -29,26 +29,13 @@ jobs: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm, Node.js and dependencies + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - - name: Set up Node - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true # ⚠️ Do not use any cache on purpose # It increases the chance of a compromised release being publish # See https://github.com/actions/setup-node/issues/1445#issuecomment-4040130833 - # cache: pnpm - package-manager-cache: false - - - name: Installation - run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile + cache: false - name: Build packages run: pnpm build:packages diff --git a/.github/workflows/lighthouse-report.yml b/.github/workflows/lighthouse-report.yml index 3d558d18f0b8..49e3546790e9 100644 --- a/.github/workflows/lighthouse-report.yml +++ b/.github/workflows/lighthouse-report.yml @@ -27,21 +27,11 @@ jobs: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm, Node.js and dependencies + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - - name: Use Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true - - - name: Install dependencies - run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile + # Security: prevents cache poisoning, as this job can write to pull requests + cache: false - name: Build website fast run: pnpm build:website:fast diff --git a/.github/workflows/lint-autofix.yml b/.github/workflows/lint-autofix.yml index 2f43efb11fda..afa9f8ce9b72 100644 --- a/.github/workflows/lint-autofix.yml +++ b/.github/workflows/lint-autofix.yml @@ -29,21 +29,11 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm, Node.js and dependencies + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - - name: Set up Node LTS - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true - - - name: Installation - run: pnpm install --frozen-lockfile || pnpm install --frozen-lockfile || pnpm install --frozen-lockfile + # Security: prevents cache poisoning, as this job can push commits to the repository + cache: false - name: AutoFix Duplicated deps run: pnpm lint:deps:fix diff --git a/.github/workflows/security-supply-chain.yml b/.github/workflows/security-supply-chain.yml index 4910e902a418..104692fda954 100644 --- a/.github/workflows/security-supply-chain.yml +++ b/.github/workflows/security-supply-chain.yml @@ -34,19 +34,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm and Node.js + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - name: Use Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true # No cache on purpose! We want SFW to fetch packages - package-manager-cache: false + cache: false + install: false # See https://socket.dev/blog/introducing-socket-firewall - name: Install Socket Firewall Free @@ -74,20 +67,12 @@ jobs: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - name: Install pnpm - uses: pnpm/setup@fa36a5ef7dcdefc3a7cb25655c122e00cf6e636e # v3.1.2 + - name: Set up pnpm and Node.js + uses: ./.github/actions/setup with: - # Only install pnpm: Node.js and dependencies are installed by later steps - install: false - node-version-file: false - - - name: Use Node.js - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 - with: - node-version: lts/* - check-latest: true # No cache on purpose! We want SFW to fetch packages - package-manager-cache: false + cache: false + install: false # See https://socket.dev/blog/introducing-socket-firewall - name: Install Socket Firewall Free