From cbcc75607b64741feb5031870974d58a3d2afb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 12 May 2026 11:08:29 +0200 Subject: [PATCH 01/10] Tweak publishing setup --- .github/actions/ci-setup/action.yml | 23 +++++++++++++++ .github/workflows/publish.yml | 46 +++++++++++++++++++---------- package.json | 8 +++-- 3 files changed, 60 insertions(+), 17 deletions(-) create mode 100644 .github/actions/ci-setup/action.yml diff --git a/.github/actions/ci-setup/action.yml b/.github/actions/ci-setup/action.yml new file mode 100644 index 0000000..db06028 --- /dev/null +++ b/.github/actions/ci-setup/action.yml @@ -0,0 +1,23 @@ +name: Setup CI + +inputs: + node-version: + description: "Node.js version" + required: false + default: 22 + +runs: + using: composite + steps: + - name: Set up pnpm + uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6 + + - name: Setup Node.js ${{ inputs.node-version }} + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version: ${{ inputs.node-version }} + cache: pnpm + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cf2919f..cd5d237 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,33 +7,49 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} +permissions: {} # each job should define its own permission explicitly + jobs: - publish: - name: Publish - if: github.repository == 'changesets/format' + version: + name: Version runs-on: ubuntu-latest + timeout-minutes: 20 + outputs: + hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} permissions: contents: write # to create release (changesets/action) + issues: write # to post issue comments (changesets/action) pull-requests: write # to create pull request (changesets/action) - id-token: write # to use OpenID Connect token for trusted publishing (changesets/action) steps: - - name: Check out repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./.github/actions/ci-setup - - name: Set up pnpm - uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6 + - name: Create or update release pull request + id: changesets + # https://github.com/changesets/action + uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 - - name: Set up Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + publish: + name: Publish + if: needs.version.outputs.hasChangesets == 'false' + needs: version + runs-on: ubuntu-latest + environment: npm + timeout-minutes: 20 + permissions: + contents: write # to create release (changesets/action) + id-token: write # to use OpenID Connect token for trusted publishing (changesets/action) + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + - uses: ./.github/actions/ci-setup with: node-version: 24 - cache: pnpm - - - name: Install dependencies - run: pnpm install - name: Build run: pnpm build - - name: Create release PR or publish to npm + - name: Publish to npm + # https://github.com/changesets/action uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 + with: + publish: pnpm release diff --git a/package.json b/package.json index 4c3a787..3c4fb12 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "test": "vitest", "format": "oxfmt", "lint": "oxfmt --check", - "typecheck": "tsc" + "typecheck": "tsc", + "release": "changeset publish" }, "dependencies": { "package-manager-detector": "^1.6.0" @@ -30,5 +31,8 @@ "typescript": "~6.0.3", "vitest": "^4.1.5" }, - "packageManager": "pnpm@11.1.0" + "packageManager": "pnpm@11.1.0", + "engines": { + "node": "^22.11 || ^24 || >=26" + } } From 1c7a00b74b24c80b38bc6531e309717e4680ff86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 12 May 2026 11:16:44 +0200 Subject: [PATCH 02/10] fmt --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3c4fb12..f9b58d7 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "typescript": "~6.0.3", "vitest": "^4.1.5" }, - "packageManager": "pnpm@11.1.0", "engines": { "node": "^22.11 || ^24 || >=26" - } + }, + "packageManager": "pnpm@11.1.0" } From e8bd80763425a290de536378e22bdf3b16970797 Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 17:55:00 +0800 Subject: [PATCH 03/10] Update --- .github/actions/ci-setup/action.yml | 10 +++++++--- .github/workflows/ci.yml | 17 +++-------------- .github/workflows/publish.yml | 14 +++----------- package.json | 3 +-- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/.github/actions/ci-setup/action.yml b/.github/actions/ci-setup/action.yml index db06028..b615b64 100644 --- a/.github/actions/ci-setup/action.yml +++ b/.github/actions/ci-setup/action.yml @@ -1,19 +1,23 @@ name: Setup CI +description: Setup CI inputs: node-version: description: "Node.js version" required: false - default: 22 + default: 24 runs: using: composite steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Set up pnpm uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6 - - name: Setup Node.js ${{ inputs.node-version }} - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + - name: Set up Node.js ${{ inputs.node-version }} + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ inputs.node-version }} cache: pnpm diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 939b7cd..162f1e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,8 @@ on: branches: - main +permissions: {} + jobs: test: name: Test @@ -15,26 +17,13 @@ jobs: # Save dprint plugins cache to node_nodules in CI for simpler caching DPRINT_CACHE_DIR: ${{ github.workspace }}/node_modules/.dprint-cache steps: - - name: Check out repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Set up pnpm - uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 - - - name: Set up Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 24 - cache: pnpm + - uses: ./.github/actions/ci-setup - name: Set up Deno uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4 with: deno-version: 2.x - - name: Install dependencies - run: pnpm install - - name: Build run: pnpm build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cd5d237..9dbd221 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,13 +7,13 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} -permissions: {} # each job should define its own permission explicitly +permissions: {} jobs: version: name: Version runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 10 outputs: hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} permissions: @@ -21,12 +21,10 @@ jobs: issues: write # to post issue comments (changesets/action) pull-requests: write # to create pull request (changesets/action) steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ./.github/actions/ci-setup - name: Create or update release pull request id: changesets - # https://github.com/changesets/action uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 publish: @@ -35,21 +33,15 @@ jobs: needs: version runs-on: ubuntu-latest environment: npm - timeout-minutes: 20 + timeout-minutes: 10 permissions: contents: write # to create release (changesets/action) id-token: write # to use OpenID Connect token for trusted publishing (changesets/action) steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: ./.github/actions/ci-setup - with: - node-version: 24 - name: Build run: pnpm build - name: Publish to npm - # https://github.com/changesets/action uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 - with: - publish: pnpm release diff --git a/package.json b/package.json index f9b58d7..0014757 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,7 @@ "test": "vitest", "format": "oxfmt", "lint": "oxfmt --check", - "typecheck": "tsc", - "release": "changeset publish" + "typecheck": "tsc" }, "dependencies": { "package-manager-detector": "^1.6.0" From f734f67d883e345930ad0180663a06e1e0fa4aff Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 17:56:06 +0800 Subject: [PATCH 04/10] Update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0014757..123bd54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@changesets/format", - "version": "0.0.1", + "version": "0.1.0", "description": "Detect and format files", "license": "MIT", "author": "Changesets", From b9460a8170c47bf0bda15ccbb72ebc6098c2b42d Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 17:57:05 +0800 Subject: [PATCH 05/10] Add note --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 162f1e8..f972c8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: steps: - uses: ./.github/actions/ci-setup + # Deno is needed for tests only - name: Set up Deno uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4 with: From e46e51ccf8134ee8dc835ea21006cb06842c98cb Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 17:58:57 +0800 Subject: [PATCH 06/10] Fix --- .github/actions/ci-setup/action.yml | 3 --- .github/workflows/ci.yml | 3 +++ .github/workflows/publish.yml | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/ci-setup/action.yml b/.github/actions/ci-setup/action.yml index b615b64..4d20298 100644 --- a/.github/actions/ci-setup/action.yml +++ b/.github/actions/ci-setup/action.yml @@ -10,9 +10,6 @@ inputs: runs: using: composite steps: - - name: Check out repo - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set up pnpm uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f972c8b..aa40be5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: # Save dprint plugins cache to node_nodules in CI for simpler caching DPRINT_CACHE_DIR: ${{ github.workspace }}/node_modules/.dprint-cache steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./.github/actions/ci-setup # Deno is needed for tests only diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9dbd221..467ddca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,6 +21,9 @@ jobs: issues: write # to post issue comments (changesets/action) pull-requests: write # to create pull request (changesets/action) steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./.github/actions/ci-setup - name: Create or update release pull request @@ -38,6 +41,9 @@ jobs: contents: write # to create release (changesets/action) id-token: write # to use OpenID Connect token for trusted publishing (changesets/action) steps: + - name: Check out repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./.github/actions/ci-setup - name: Build From abf713a824dc502e662953b65cb9f81ec00e2aae Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 17:59:44 +0800 Subject: [PATCH 07/10] Update --- .github/actions/ci-setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/ci-setup/action.yml b/.github/actions/ci-setup/action.yml index 4d20298..9792cc3 100644 --- a/.github/actions/ci-setup/action.yml +++ b/.github/actions/ci-setup/action.yml @@ -3,7 +3,7 @@ description: Setup CI inputs: node-version: - description: "Node.js version" + description: Node.js version required: false default: 24 From bca6aa2d75043c988176595211d5002fb3c50275 Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 18:03:06 +0800 Subject: [PATCH 08/10] Revert --- .github/workflows/publish.yml | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 467ddca..f243463 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,3 +51,5 @@ jobs: - name: Publish to npm uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 + with: + publish: pnpm release diff --git a/package.json b/package.json index 123bd54..73f39e5 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "test": "vitest", "format": "oxfmt", "lint": "oxfmt --check", - "typecheck": "tsc" + "typecheck": "tsc", + "release": "changeset publish" }, "dependencies": { "package-manager-detector": "^1.6.0" From b2fe3765e7e11932d560ad36aaffbdac28cf9604 Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 18:04:48 +0800 Subject: [PATCH 09/10] Tighten permissions --- .github/workflows/publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f243463..4f0c393 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,8 +17,6 @@ jobs: outputs: hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} permissions: - contents: write # to create release (changesets/action) - issues: write # to post issue comments (changesets/action) pull-requests: write # to create pull request (changesets/action) steps: - name: Check out repo From 26ec818791274a14a0238916b416d8255956c140 Mon Sep 17 00:00:00 2001 From: bluwy Date: Tue, 12 May 2026 19:44:51 +0800 Subject: [PATCH 10/10] Add back permission --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4f0c393..ff70e29 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,6 +17,7 @@ jobs: outputs: hasChangesets: ${{ steps.changesets.outputs.hasChangesets }} permissions: + contents: write # to create version commits (changesets/action) pull-requests: write # to create pull request (changesets/action) steps: - name: Check out repo