Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.3 KB
Raw Blame
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`)
}