Skip to content

Commit 03378bc

Browse files
authored
chore: update PR lint workflow and projenrc with package scopes (#609)
This PR updates the PR lint workflow and projenrc configuration to dynamically generate the list of allowed scopes based on the monorepo packages. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent e272c5e commit 03378bc

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.github/workflows/pull-request-lint.yml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,7 @@ const repoProject = new yarn.Monorepo({
232232
},
233233
semanticTitleOptions: {
234234
types: ['feat', 'fix', 'chore', 'refactor', 'test', 'docs', 'revert'],
235-
scopes: [
236-
'cdk-assets',
237-
'cli',
238-
'cli-lib-alpha',
239-
'cli-plugin-contract',
240-
'cloud-assembly-schema',
241-
'cloudformation-diff',
242-
'deps',
243-
'dev-deps',
244-
'docs',
245-
'integ-runner',
246-
'integ-testing',
247-
'toolkit-lib',
248-
],
235+
scopes: [], // actually set at the bottom of the file to be based on monorepo packages
249236
},
250237
},
251238
},
@@ -1736,4 +1723,24 @@ new LargePrChecker(repo, {
17361723

17371724
((repo.github?.tryFindWorkflow('integ')?.getJob('prepare') as Job | undefined)?.env ?? {}).DEBUG = 'true';
17381725

1726+
// Set allowed scopes based on monorepo packages
1727+
const disallowed = new Set([
1728+
'cdk', // use aws-cdk or cli
1729+
'user-input-gen', // use cli
1730+
]);
1731+
repoProject.github?.tryFindWorkflow('pull-request-lint')?.file?.patch(
1732+
pj.JsonPatch.replace('/jobs/validate/steps/0/with/scopes', [
1733+
'cli',
1734+
'deps',
1735+
'dev-deps',
1736+
'docs',
1737+
'integ-testing',
1738+
'toolkit-lib',
1739+
...repoProject.subprojects
1740+
.filter(p => p instanceof yarn.TypeScriptWorkspace)
1741+
.map(p => p.name)
1742+
.map(n => n.split('/').pop()),
1743+
].filter(s => s && !disallowed.has(s)).sort().join('\n')),
1744+
);
1745+
17391746
repo.synth();

0 commit comments

Comments
 (0)