github-action-readme-generator 1.12.7 → 1.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/bin/index.js +677 -523
- package/dist/mjs/index.d.ts +2 -3
- package/dist/mjs/index.js +37 -16
- package/package.json +4 -4
package/dist/mjs/index.d.ts
CHANGED
package/dist/mjs/index.js
CHANGED
|
@@ -717,14 +717,15 @@ function getCurrentVersionString(inputs) {
|
|
|
717
717
|
const actionDir = path$1.dirname(inputs.action.path);
|
|
718
718
|
log.debug(`version source: ${versionSource}`);
|
|
719
719
|
let detectedVersion;
|
|
720
|
-
if (versionSource === "explicit")
|
|
721
|
-
|
|
722
|
-
|
|
720
|
+
if (versionSource === "explicit") {
|
|
721
|
+
if (override && override.length > 0) {
|
|
722
|
+
detectedVersion = override;
|
|
723
|
+
log.debug(`using explicit version override: ${detectedVersion}`);
|
|
724
|
+
} else {
|
|
725
|
+
log.debug("explicit mode but no version_override set, falling back to 0.0.0");
|
|
726
|
+
detectedVersion = "0.0.0";
|
|
727
|
+
}
|
|
723
728
|
} else {
|
|
724
|
-
log.debug("explicit mode but no version_override set, falling back to 0.0.0");
|
|
725
|
-
detectedVersion = "0.0.0";
|
|
726
|
-
}
|
|
727
|
-
else {
|
|
728
729
|
switch (versionSource) {
|
|
729
730
|
case "git-branch":
|
|
730
731
|
detectedVersion = getVersionFromGitBranch(actionDir, log);
|
|
@@ -1489,10 +1490,12 @@ function loadConfig(log, providedConfig, configFilePath) {
|
|
|
1489
1490
|
const config = providedConfig ?? new Provider();
|
|
1490
1491
|
if (process.env.GITHUB_ACTION === "true") log.info("Running in GitHub action");
|
|
1491
1492
|
config.argv(argvOptions);
|
|
1492
|
-
if (configFilePath)
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1493
|
+
if (configFilePath) {
|
|
1494
|
+
if (fs.existsSync(configFilePath)) {
|
|
1495
|
+
log.info(`Config file found: ${configFilePath}`);
|
|
1496
|
+
config.file(configFilePath);
|
|
1497
|
+
} else log.debug(`Config file not found: ${configFilePath}`);
|
|
1498
|
+
}
|
|
1496
1499
|
config.env({
|
|
1497
1500
|
lowerCase: true,
|
|
1498
1501
|
parseValues: true,
|
|
@@ -1953,13 +1956,18 @@ function headerToAnchor(text) {
|
|
|
1953
1956
|
function extractHeaders(content) {
|
|
1954
1957
|
const headers = [];
|
|
1955
1958
|
const lines = content.split("\n");
|
|
1956
|
-
let
|
|
1959
|
+
let codeFence;
|
|
1957
1960
|
for (const line of lines) {
|
|
1958
|
-
|
|
1959
|
-
|
|
1961
|
+
const fenceMatch = /^\s*(`{3,}|~{3,})/.exec(line);
|
|
1962
|
+
if (codeFence) {
|
|
1963
|
+
const fenceCharacter = codeFence[0];
|
|
1964
|
+
if (new RegExp(`^\\s*${fenceCharacter}{${codeFence.length},}\\s*$`).test(line)) codeFence = void 0;
|
|
1965
|
+
continue;
|
|
1966
|
+
}
|
|
1967
|
+
if (fenceMatch) {
|
|
1968
|
+
codeFence = fenceMatch[1];
|
|
1960
1969
|
continue;
|
|
1961
1970
|
}
|
|
1962
|
-
if (inCodeBlock) continue;
|
|
1963
1971
|
const headerMatch = /^(#{2,6})\s+(.+)$/.exec(line);
|
|
1964
1972
|
if (headerMatch) {
|
|
1965
1973
|
const level = headerMatch[1].length;
|
|
@@ -2224,6 +2232,13 @@ function updateTitle(sectionToken, inputs) {
|
|
|
2224
2232
|
}
|
|
2225
2233
|
//#endregion
|
|
2226
2234
|
//#region src/sections/update-usage.ts
|
|
2235
|
+
/**
|
|
2236
|
+
* Renders the `usage` section: a fenced workflow snippet naming every action input,
|
|
2237
|
+
* each preceded by its description and default as YAML comments.
|
|
2238
|
+
* @param {ReadmeSection} sectionToken - The README marker pair to write the section into.
|
|
2239
|
+
* @param {Inputs} inputs - The parsed action metadata and the README editor to write with.
|
|
2240
|
+
* @returns {Promise<Record<string, string>>} The rendered section, keyed by its section token.
|
|
2241
|
+
*/
|
|
2227
2242
|
async function updateUsage(sectionToken, inputs) {
|
|
2228
2243
|
const log = new LogTask(sectionToken);
|
|
2229
2244
|
log.start();
|
|
@@ -2233,6 +2248,8 @@ async function updateUsage(sectionToken, inputs) {
|
|
|
2233
2248
|
log.info(`Version string: ${versionString}`);
|
|
2234
2249
|
const actionReference = `${actionName}@${versionString}`;
|
|
2235
2250
|
const indent = " # ";
|
|
2251
|
+
const defaultLabel = "Default: ";
|
|
2252
|
+
const defaultHang = " ".repeat(9);
|
|
2236
2253
|
const content = [];
|
|
2237
2254
|
content.push("```yaml", `- uses: ${actionReference}`, " with:");
|
|
2238
2255
|
const inp = inputs.action.inputs;
|
|
@@ -2259,7 +2276,11 @@ async function updateUsage(sectionToken, inputs) {
|
|
|
2259
2276
|
if (input !== void 0) {
|
|
2260
2277
|
if (!firstInput) content.push("");
|
|
2261
2278
|
content.push(...descriptions[key]);
|
|
2262
|
-
if (input.default !== void 0)
|
|
2279
|
+
if (input.default !== void 0) {
|
|
2280
|
+
const [firstLine, ...rest] = `${input.default}`.split(/\r\n|\n|\r/);
|
|
2281
|
+
content.push(`${indent}${defaultLabel}${firstLine}`.trimEnd());
|
|
2282
|
+
for (const line of rest) content.push(`${indent}${defaultHang}${line}`.trimEnd());
|
|
2283
|
+
}
|
|
2263
2284
|
content.push(` ${key}: ''`);
|
|
2264
2285
|
firstInput = false;
|
|
2265
2286
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-action-readme-generator",
|
|
3
3
|
"displayName": "bitflight-devops/github-action-readme-generator",
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.9",
|
|
5
5
|
"description": "The docs generator for GitHub Actions. Auto-syncs action.yml to README.md with 8 sections: inputs, outputs, usage, badges, branding & more. Works as CLI or GitHub Action.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"github-actions",
|
|
@@ -149,11 +149,11 @@
|
|
|
149
149
|
"@commitlint/prompt": "^21.0.1",
|
|
150
150
|
"@semantic-release/changelog": "^7.0.0",
|
|
151
151
|
"@semantic-release/exec": "^7.1.0",
|
|
152
|
-
"@semantic-release/git": "^
|
|
152
|
+
"@semantic-release/git": "^11.0.1",
|
|
153
153
|
"@tsconfig/node24": "^24.0.4",
|
|
154
154
|
"@types/nconf": "^0.10.5",
|
|
155
155
|
"@types/node": "^26.1.1",
|
|
156
|
-
"@vitest/coverage-v8": "4.1.
|
|
156
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
157
157
|
"@voidzero-dev/vite-plus-core": "0.2.8",
|
|
158
158
|
"commitizen": "^4.3.1",
|
|
159
159
|
"conventional-commits": "^1.6.0",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
"semantic-release": "^25.0.2",
|
|
169
169
|
"types-package-json": "^2.0.39",
|
|
170
170
|
"typescript": "7.0.2",
|
|
171
|
-
"vite-plus": "0.
|
|
171
|
+
"vite-plus": "0.3.1"
|
|
172
172
|
},
|
|
173
173
|
"engines": {
|
|
174
174
|
"node": ">=24.19.0 <30.0.0",
|