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:
Shahed Nasser
2023-10-25 17:12:10 +03:00
committed by GitHub
parent e64823d1b9
commit 2ac05066ac
15 changed files with 233 additions and 233 deletions

View 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)