Skip to content

Commit def5bea

Browse files
mrgraingithub-actions
and
github-actions
authored
fix(monorepo): npm provenance is not respected (#800)
* fix(monorepo): npm provenance is not respected * chore: self mutation Signed-off-by: github-actions <[email protected]> --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 45da9d7 commit def5bea

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/yarn/typescript-workspace-release.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class WorkspaceRelease extends Component {
6464
this.publisher.publishToNpm({
6565
registry: project.package.npmRegistry,
6666
npmTokenSecret: project.package.npmTokenSecret,
67+
npmProvenance: project.package.npmProvenance,
6768
});
6869
}
6970
}

test/__snapshots__/cdklabs-monorepo.test.ts.snap

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cdklabs-monorepo.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,25 @@ describe('CdkLabsMonorepo', () => {
199199
})]),
200200
}));
201201
});
202+
203+
test('will automatically enable npm release provenance', () => {
204+
const one = new yarn.TypeScriptWorkspace({
205+
parent,
206+
name: '@cdklabs/one',
207+
npmDistTag: 'foobar',
208+
});
209+
210+
Testing.synth(parent);
211+
212+
expect(one.package.npmProvenance).toBe(true);
213+
expect(parent.github?.tryFindWorkflow('release')?.getJob('cdklabs-one_release_npm'))
214+
.toMatchObject(expect.objectContaining({
215+
steps: expect.arrayContaining([expect.objectContaining({
216+
name: 'Release',
217+
env: expect.objectContaining({ NPM_CONFIG_PROVENANCE: 'true' }),
218+
})]),
219+
}));
220+
});
202221
});
203222

204223
describe('VSCode Workspace', () => {

0 commit comments

Comments
 (0)