diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index eef5017..d13fe6b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -21,6 +21,8 @@ jobs: id-token: write steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - uses: actions/setup-node@v4 with: diff --git a/tests/package-contract.test.mjs b/tests/package-contract.test.mjs index 748a589..9d12c08 100644 --- a/tests/package-contract.test.mjs +++ b/tests/package-contract.test.mjs @@ -55,6 +55,10 @@ test('npm publishing uses trusted publishing instead of repository tokens', () = assert.match(publishWorkflow, /id-token:\s+write/); assert.match(publishWorkflow, /npm publish --access public --provenance/); assert.doesNotMatch(publishWorkflow, /NODE_AUTH_TOKEN|NPM_TOKEN/); + assert.match( + publishWorkflow, + /actions\/checkout@v4\s+with:\s+fetch-depth:\s+0/, + ); assert.match(publishWorkflow, /playwright install --with-deps chromium/); assert.match(publishWorkflow, /npm run release:preflight/); }); diff --git a/tests/release-provenance.test.mjs b/tests/release-provenance.test.mjs index f1b81bd..b185c5b 100644 --- a/tests/release-provenance.test.mjs +++ b/tests/release-provenance.test.mjs @@ -74,14 +74,28 @@ test('published JSON schema describes the executable provenance contract', async assert.match(DIGEST, new RegExp(schema.properties.interaction_contract_digest.pattern)); }); -test('the 0.3.3 candidate remains untagged until the protected release', async () => { - const result = await checkReleaseProvenance({ - repoRoot: resolve(import.meta.dirname, '..'), - allowUnreleased: true, +test('candidate tag state is reported from an isolated repository', async () => { + await withRepository(async (root) => { + await generateReleaseProvenance({ + repoRoot: root, + interactionContractDigest: DIGEST, + }); + git(root, 'add', 'RELEASE_PROVENANCE.json'); + git(root, 'commit', '--quiet', '-m', 'attest candidate'); + + const untagged = await checkReleaseProvenance({ + repoRoot: root, + allowUnreleased: true, + }); + assert.equal(untagged.tag, 'v0.3.3'); + assert.equal(untagged.tagExists, false); + assert.equal(untagged.currentAheadOfPublishedTag, false); + + git(root, 'tag', 'v0.3.3'); + const tagged = await checkReleaseProvenance({ repoRoot: root }); + assert.equal(tagged.tagExists, true); + assert.equal(tagged.currentAheadOfPublishedTag, false); }); - assert.equal(result.tag, 'v0.3.3'); - assert.equal(result.tagExists, false); - assert.equal(result.currentAheadOfPublishedTag, false); }); test('formal provenance generation uses a clean frozen commit and cannot re-sign a tag', async () => {