ci: restore hosted-run headroom
This commit is contained in:
40
scripts/lint-shards.ts
Normal file
40
scripts/lint-shards.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/** Lint-lane selection for GitHub Actions. */
|
||||
|
||||
/** One ESLint target set and whether it owns the cross-file duplication gate. */
|
||||
export interface LintSelection {
|
||||
/** Shell-free arguments passed to ESLint before its cache options. */
|
||||
eslintTargets: readonly string[]
|
||||
/** Whether this lane also runs the repository-wide duplication check. */
|
||||
includeDuplication: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Select an exhaustive lint partition without changing the ordinary local lint command.
|
||||
*
|
||||
* @param name Optional stable shard name from `DSH_LINT_SHARD`.
|
||||
* @returns ESLint targets and ownership of the duplication gate.
|
||||
*/
|
||||
export function selectLintShard(name?: string): LintSelection {
|
||||
switch (name) {
|
||||
case undefined:
|
||||
case '':
|
||||
return { eslintTargets: ['.'], includeDuplication: true }
|
||||
case 'package-sources':
|
||||
return { eslintTargets: ['packages/*/*/src/**/*.ts'], includeDuplication: false }
|
||||
case 'package-tests':
|
||||
return { eslintTargets: ['packages/*/*/tests/**/*.ts'], includeDuplication: false }
|
||||
case 'repository':
|
||||
return {
|
||||
eslintTargets: [
|
||||
'.',
|
||||
'--ignore-pattern',
|
||||
'packages/*/*/src/**',
|
||||
'--ignore-pattern',
|
||||
'packages/*/*/tests/**',
|
||||
],
|
||||
includeDuplication: true,
|
||||
}
|
||||
default:
|
||||
throw new Error(`run-gates: unknown DSH_LINT_SHARD ${JSON.stringify(name)}.`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user