chore(docs): add empty changeset step to actions (#6377)
- Creates a script that runs the `yarn changeset --empty` command if there are file changes. This is important to not create PRs of just empty changesets if there are no file changes. - Run script in all docs-generation PRs - Fix to condition in `generate-docblock` action
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
"merge:references": "yarn generate:reference merge",
|
||||
"check:freshness": "ts-node ./freshness-check.ts",
|
||||
"generate:message": "ts-node ./get-generate-diff-message.ts",
|
||||
"check:release-commit": "node ./dist/check-release-commit.js"
|
||||
"check:release-commit": "node ./dist/check-release-commit.js",
|
||||
"generate:changeset": "node ./dist/run-changeset.js"
|
||||
},
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
|
||||
26
docs-util/packages/scripts/run-changeset.ts
Normal file
26
docs-util/packages/scripts/run-changeset.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import util from "node:util"
|
||||
import { exec } from "child_process"
|
||||
import path from "node:path"
|
||||
|
||||
const promiseExec = util.promisify(exec)
|
||||
|
||||
async function main() {
|
||||
// check if there are any changes in diff
|
||||
const diffFiles = (await promiseExec(`git diff --name-only`)).stdout
|
||||
.toString()
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
|
||||
if (!diffFiles.length) {
|
||||
console.log("No files were changed, skipping generating changeset...")
|
||||
return
|
||||
}
|
||||
|
||||
// run changeset
|
||||
await promiseExec(`yarn changeset --empty`, {
|
||||
cwd: path.resolve("..", "..", ".."),
|
||||
})
|
||||
console.log("Generated changeset.")
|
||||
}
|
||||
|
||||
void main()
|
||||
Reference in New Issue
Block a user