Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
release: template tree hash from the gated release commit
garrytan326d130bee2e
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 1a61547703..f67682bb3a 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -48,7 +48,6 @@ jobs:outputs:version: ${{ steps.v.outputs.version }}exists: ${{ steps.v.outputs.exists }}- template_tree_hash: ${{ steps.v.outputs.template_tree_hash }}steps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- id: v@@ -58,13 +57,6 @@ jobs:run: |version="$(tr -d '[:space:]' < VERSION)"echo "version=$version" >> "$GITHUB_OUTPUT"- # [C3] Record the vendored template tree's git hash alongside the- # asset completeness check. The publish-template job embeds it in- # the template repo's commit message, so template-repo HEAD can be- # audited back to the exact reviewed tree in THIS repo. Empty until- # templates/bootstrap/template-repo/ is vendored.- tree_hash="$(git rev-parse "HEAD:templates/bootstrap/template-repo" 2>/dev/null || true)"- echo "template_tree_hash=$tree_hash" >> "$GITHUB_OUTPUT"# Complete = release exists AND carries every asset the self-updater# can request. A partial release must NOT short-circuit, so a re-run# can repair it.@@ -309,9 +301,16 @@ jobs:name: Force-push the template repoenv:RELEASE_VERSION: ${{ needs.version.outputs.version }}- TEMPLATE_TREE_HASH: ${{ needs.version.outputs.template_tree_hash }}+ RELEASE_SHA: ${{ needs.ci-gate.outputs.sha }}run: |set -euo pipefail+ # [C3] The vendored template tree's git hash at the gated release+ # commit (the commit this job checked out and the release was+ # published at, which differs from github.sha when a cancelled push+ # was followed to a newer commit). Embedded in the template repo's+ # commit message so template-repo HEAD audits back to the exact+ # reviewed tree in THIS repo. Empty until the tree is vendored.+ TEMPLATE_TREE_HASH="$(git rev-parse "${RELEASE_SHA}:templates/bootstrap/template-repo" 2>/dev/null || true)"cd /tmp/template-treegit init -q -b maingit config user.name "gbrain-release-bot"diff --git a/test/scripts/release-gate.test.ts b/test/scripts/release-gate.test.tsindex f02f5a82d2..fcff5257b8 100644--- a/test/scripts/release-gate.test.ts+++ b/test/scripts/release-gate.test.ts@@ -110,4 +110,13 @@ describe('release.yml waits for the CI gate', () => {expect(advance.run).toContain('+${RELEASE_SHA}:refs/tags/latest-stable');expect(advance.env!.RELEASE_SHA).toBe('${{ needs.ci-gate.outputs.sha }}');});++ test('publish-template takes the template tree hash from the gated commit, not github.sha', () => {+ const push = wf.jobs['publish-template']!.steps.find(s => s.run?.includes('git push --force'))!;+ expect(push.env!.RELEASE_SHA).toBe('${{ needs.ci-gate.outputs.sha }}');+ expect(push.run).toContain('TEMPLATE_TREE_HASH="$(git rev-parse "${RELEASE_SHA}:templates/bootstrap/template-repo" 2>/dev/null || true)"');+ expect(push.run!.indexOf('TEMPLATE_TREE_HASH="$(git rev-parse')).toBeLessThan(push.run!.indexOf('cd /tmp/template-tree'));+ expect(push.env!.TEMPLATE_TREE_HASH).toBeUndefined();+ expect(readFileSync(join(import.meta.dir, '../../.github/workflows/release.yml'), 'utf8')).not.toContain('template_tree_hash');+ });});