From 60219f9a0e5f84ec94898febce560eaa4a056e9c Mon Sep 17 00:00:00 2001 From: Mattia Manzati Date: Sat, 20 Jun 2026 13:00:51 +0200 Subject: [PATCH] chore: track native preview gitHead --- .changeset/native-preview-githead.md | 5 +++++ .github/workflows/update-typescript-go.yml | 23 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .changeset/native-preview-githead.md diff --git a/.changeset/native-preview-githead.md b/.changeset/native-preview-githead.md new file mode 100644 index 00000000..a0a2e141 --- /dev/null +++ b/.changeset/native-preview-githead.md @@ -0,0 +1,5 @@ +--- +"@effect/tsgo": patch +--- + +Fix the automated TypeScript-Go update workflow to pin the submodule to the commit shipped by `@typescript/native-preview@latest`. diff --git a/.github/workflows/update-typescript-go.yml b/.github/workflows/update-typescript-go.yml index 02a38bd4..bacf5176 100644 --- a/.github/workflows/update-typescript-go.yml +++ b/.github/workflows/update-typescript-go.yml @@ -68,8 +68,22 @@ jobs: id: before run: echo "sha=$(git -C typescript-go rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Resolve native preview metadata + id: native_preview + run: | + metadata="$(npm view @typescript/native-preview@latest version gitHead --json)" + version="$(node -e 'const m = JSON.parse(process.argv[1]); if (!m.version) process.exit(1); process.stdout.write(m.version)' "$metadata")" + git_head="$(node -e 'const m = JSON.parse(process.argv[1]); if (!/^[0-9a-f]{40}$/.test(m.gitHead || "")) process.exit(1); process.stdout.write(m.gitHead)' "$metadata")" + + echo "version=${version}" >> "$GITHUB_OUTPUT" + echo "git_head=${git_head}" >> "$GITHUB_OUTPUT" + - name: Update TypeScript-Go submodule - run: git submodule update --init --remote typescript-go + run: | + git -C typescript-go fetch --depth 1 origin "${{ steps.native_preview.outputs.git_head }}" + git -C typescript-go checkout --detach "${{ steps.native_preview.outputs.git_head }}" + git -C typescript-go submodule sync --recursive + git -C typescript-go submodule update --init --recursive --force - name: Regenerate shims and generated files run: pnpm setup-repo --ci @@ -124,9 +138,11 @@ jobs: "@effect/tsgo": patch --- - Update \ + Update to \ + [\`@typescript/native-preview@${{ steps.native_preview.outputs.version }}\`](https://www.npmjs.com/package/@typescript/native-preview/v/${{ steps.native_preview.outputs.version }}), \ + which ships \ [\`typescript-go\`](https://github.com/microsoft/typescript-go/commit/${{ steps.after.outputs.sha }}) \ - to commit \`${{ steps.after.outputs.sha }}\`. + commit \`${{ steps.after.outputs.sha }}\`. EOF - name: Create Pull Request @@ -144,6 +160,7 @@ jobs: ## TypeScript-Go + - Native preview version: `@typescript/native-preview@${{ steps.native_preview.outputs.version }}` - Previous commit: `${{ steps.before.outputs.sha }}` - Updated commit: `${{ steps.after.outputs.sha }}` - Compare: ${{ steps.changelog.outputs.compare_url }}