chore(docs-util): Improve generate references script and action (#5472)
* chore(docs-util): Improve generate references script and action * added if condition for API reference * fix api reference condition * fix description of action * fix body value * fix step name
This commit is contained in:
27
docs-util/packages/scripts/get-generate-diff-message.ts
Normal file
27
docs-util/packages/scripts/get-generate-diff-message.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { execSync } from "child_process"
|
||||
import * as core from "@actions/core"
|
||||
|
||||
const command = `git --no-pager diff --minimal --name-only ../../../www/apps/docs/content/references`
|
||||
const diffOutput = execSync(command).toString()
|
||||
|
||||
const files = diffOutput.toString().split("\n").filter(Boolean)
|
||||
|
||||
const referenceNames: Set<string> = new Set([])
|
||||
|
||||
files.forEach((file) => {
|
||||
const referenceName = file
|
||||
.replace("www/apps/docs/content/references/", "")
|
||||
.split("/")[0]
|
||||
|
||||
if (referenceName) {
|
||||
referenceNames.add(referenceName)
|
||||
}
|
||||
})
|
||||
|
||||
let strOutput = "Generated the following references:\n"
|
||||
|
||||
referenceNames.forEach((referenceName) => {
|
||||
strOutput += `- \`${referenceName}\`\n`
|
||||
})
|
||||
|
||||
core.setOutput("body", strOutput)
|
||||
Reference in New Issue
Block a user