diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..661db58 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +/.github/** @Andarist @bluwy diff --git a/.github/actions/ci-setup/action.yml b/.github/actions/ci-setup/action.yml index 9792cc3..200c537 100644 --- a/.github/actions/ci-setup/action.yml +++ b/.github/actions/ci-setup/action.yml @@ -6,6 +6,10 @@ inputs: description: Node.js version required: false default: 24 + skip-cache: + description: "Whether to skip the cache" + required: false + default: "false" runs: using: composite @@ -17,8 +21,9 @@ runs: uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ inputs.node-version }} - cache: pnpm + package-manager-cache: ${{ inputs.skip-cache != 'true' }} + cache: ${{ inputs.skip-cache != 'true' && 'pnpm' || '' }} - name: Install dependencies shell: bash - run: pnpm install + run: pnpm install --frozen-lockfile diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7495a7f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + cooldown: + default-days: 7 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa40be5..be044f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,39 @@ name: CI on: pull_request: - push: + # merge queue is required so all commits on target branches trigger this workflow + # despite lack of the push event trigger here + merge_group: branches: - main -permissions: {} +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.sha }} + cancel-in-progress: true jobs: + lint-workflows: + name: Lint workflows + runs-on: ubuntu-latest + permissions: + actions: read # only required in private repos + security-events: write # allow writing security events + steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Run zizmor + uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3 + with: + persona: pedantic + annotations: true + advanced-security: false + test: name: Test runs-on: ubuntu-latest @@ -19,6 +45,8 @@ jobs: steps: - name: Check out repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - uses: ./.github/actions/ci-setup @@ -39,3 +67,13 @@ jobs: - name: Test run: pnpm test + + ci-ok: + name: CI OK + runs-on: ubuntu-latest + if: always() + needs: [lint-workflows, test] + steps: + - name: Exit with error if some jobs are not successful + run: exit 1 + if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ff70e29..2723f27 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,10 @@ on: branches: - main -concurrency: ${{ github.workflow }}-${{ github.ref }} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + queue: max permissions: {} @@ -22,8 +25,12 @@ jobs: steps: - name: Check out repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - uses: ./.github/actions/ci-setup + with: + skip-cache: true # avoid cache poisoning attacks - name: Create or update release pull request id: changesets @@ -42,8 +49,12 @@ jobs: steps: - name: Check out repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - uses: ./.github/actions/ci-setup + with: + skip-cache: true # avoid cache poisoning attacks - name: Build run: pnpm build