Sync upstream v3.2.4: slim install refs, a crash-safe installer, Change project restarts the agent (v3.2.4)

AI Assisted
This commit is contained in:
jparkerweb committed 2026-12-03 15:17:47 -08:00
1 parent 50319aa332
commit f997a82c4d
45 files changed
+7851 -306

No files matched your search

+40 -9
View File
@@ -137,6 +137,8 @@ jobs:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@v8.0.2
with:
path: dist
@@ -187,18 +189,47 @@ jobs:
if [ "$state" = "true" ]; then
gh release edit "$TAG" --draft=false
fi
- name: Move the release branch to this tag
- name: Publish the slim install refs
# The README's first install is `npx --allow-git=all git+https://github.com/jparkerweb/plan2code.git#release`, so new users
# get the newest release and never a half-finished main. Last step, after the release is
# public: a failure earlier leaves the branch on the previous release. Fast-forward only
# (no --force), so a tag that is not ahead of the branch fails loudly instead of
# rewinding what people install.
# get the newest release and never a half-finished main, and exact updates fetch the
# immutable `install-vX.Y.Z` tag. scripts/publish-install-refs.mjs builds one synthetic
# commit holding only the runtime payload (install.js, package.json, version.json, src/)
# and a manifest binding it to this tag, then pushes it to both refs in one atomic push.
# Last step, after the release is public: a failure earlier leaves both refs on the
# previous release. Fast-forward only (no --force), and an existing install tag is never
# overwritten, so a bad run fails loudly instead of rewinding what people install.
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898099+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898099+github-actions[bot]@users.noreply.github.com
run: |
# The checkout is shallow, and git decides "fast-forward" locally: without the full
# history the branch's old tip is unknown here and the push is refused as "fetch first".
# The push authenticates with the workflow token through an askpass helper: the helper
# script contains no secret, the token itself stays only in this step's process
# environment, and actions/checkout does not persist it into .git/config.
cat > "$RUNNER_TEMP/p2c-git-askpass.sh" <<'EOF'
#!/bin/sh
case "$1" in
*Username*) printf '%s\n' x-access-token ;;
*) printf '%s\n' "$GH_TOKEN" ;;
esac
EOF
chmod +x "$RUNNER_TEMP/p2c-git-askpass.sh"
export GIT_ASKPASS="$RUNNER_TEMP/p2c-git-askpass.sh"
export GIT_TERMINAL_PROMPT=0
export GCM_INTERACTIVE=never
git config credential.helper ""
git config credential.username x-access-token
# The checkout is shallow, and the publisher needs the release branch's old tip as the
# new commit's parent and to check the move is a fast-forward.
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
git fetch --no-tags --unshallow origin
fi
git fetch --no-tags origin "refs/tags/${TAG}:refs/tags/${TAG}"
sha="$(git rev-parse "refs/tags/${TAG}^{commit}")"
git push origin "${sha}:refs/heads/release"
if git ls-remote --exit-code --heads origin release > /dev/null; then
git fetch --no-tags origin "+refs/heads/release:refs/remotes/origin/release"
fi
# The release branch already exists. A fork or first migration without one
# intentionally fails here rather than guessing; bootstrap it locally with the
# publisher's explicit --allow-missing-release-branch.
node scripts/publish-install-refs.mjs --tag "$TAG" --repo "$GITHUB_WORKSPACE"