Files
orca/config/scripts/mobile-release-check-scope.mjs
T
Neil 7c50009ca4 test: remove duplicated cases and source-text checks (#26546)
* test: remove copied logic and literal-only checks

* test: remove duplicated SSH cases and source-text inventories

* test: retire removed SSH literal check from reliability gate

* ci: skip Ruby release checks for reliability metadata
2026-10-08 04:51:48 -07:00

39 lines
1.3 KiB
JavaScript

import { appendFileSync, readFileSync } from 'node:fs'
import { pathToFileURL } from 'node:url'
import { isDocsOnlyPath } from './pr-code-change-scope.mjs'
const APPLICATION_PREFIXES = ['src/', 'mobile/app/', 'mobile/src/']
// The root lockfile triggers Mobile Checks for its tests and typechecks; the Ruby release checks
// read no root Node dependency.
const NON_RELEASE_FILES = new Set([
'mobile/README.md',
'pnpm-lock.yaml',
'config/reliability-gates.jsonc'
])
export function shouldRunMobileReleaseChecks(files) {
return (
files.length === 0 ||
files.some(
(file) =>
!isDocsOnlyPath(file) &&
!NON_RELEASE_FILES.has(file) &&
!file.startsWith('mobile/docs/') &&
!(
APPLICATION_PREFIXES.some((prefix) => file.startsWith(prefix)) &&
/\.(?:[cm]?[jt]sx?|css|md)$/.test(file)
)
)
)
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
const input = readFileSync(process.argv[2], 'utf8')
const files = input.endsWith('\0') ? input.slice(0, -1).split('\0') : []
const shouldRun = shouldRunMobileReleaseChecks(files)
console.log(
shouldRun ? 'Checking Ruby release inputs.' : 'Only application or documentation changed.'
)
appendFileSync(process.env.GITHUB_OUTPUT, `should_run=${shouldRun}\n`)
}