iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

npm: only the tip of the mirror's main writes to npm #27

merged kernel-npm-tip-only was squashed into main as 088d957 by jonas, 2026-11-27 17:54 UTC. jonas opened it 2026-11-27 17:54 UTC.

The reviewer's read of pull 26 (card tasks/build-and-validate-the-standalone-npm-publisher.md), finding 3: the stale-run check compared version text and did not hold across a change of the base version. The publish job now reads the mirror's main and stops unless its own commit is still the tip, so a run that waited, or a rerun of an older commit, moves no tag back. One workflow file.

Session: claude 11c408f7-7edb-4a8d-8a49-8382fb8307e6 on beelink

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Conversation

Nobody has said anything yet.

Sign in to comment or to merge.

Files

1 file changed

M .github/workflows/npm-publish.yml
@@ -116,7 +116,14 @@
         with:
           name: tarball
           path: ${{ runner.temp }}/tarball
-      - run: node .github/npm-publish.mjs publish --tarball "$(ls "$RUNNER_TEMP"/tarball/*.tgz)" --dist-tag "$DIST_TAG"
+      # Only main's tip writes to npm. A run of an older commit (one that waited, or a rerun) stops
+      # here, so that no tag moves back; the tip's own run publishes what both changed.
+      - id: tip
+        run: |
+          tip="$(git ls-remote "https://github.com/$GITHUB_REPOSITORY" refs/heads/main | cut -f1)"
+          if [ "$tip" = "$GITHUB_SHA" ]; then echo "is=true" >> "$GITHUB_OUTPUT"; else echo "main is at $tip, not at $GITHUB_SHA: not published" | tee -a "$GITHUB_STEP_SUMMARY"; fi
+      - if: steps.tip.outputs.is == 'true'
+        run: node .github/npm-publish.mjs publish --tarball "$(ls "$RUNNER_TEMP"/tarball/*.tgz)" --dist-tag "$DIST_TAG"
         env:
           DIST_TAG: ${{ inputs.action || 'main' }}
   check: