Skip to content
Source
Sign inSign up
TanStack/cli
Open History to see the last commit

release-detect-changes.mjs

25 lines623 Bytes

1import { execSync } from 'node:child_process'
2import { appendFileSync } from 'node:fs'
3​
4function run(command) {
5 return execSync(command, { encoding: 'utf8' }).trim()
6}
7​
8function setOutput(name, value) {
9 const outputPath = process.env.GITHUB_OUTPUT
10 if (!outputPath) return
11 appendFileSync(outputPath, `${name}=${value}\n`)
13​
14function main() {
15 const hasChanges = run('git status --porcelain').length > 0
16 setOutput('has_changes', String(hasChanges))
17​
18 if (hasChanges) {
19 console.log('Detected versioning changes to commit and publish.')
20 } else {
21 console.log('No release changes detected.')
22 }
24​
25main()