github-action-readme-generator
Version:
This is a CLI tool and GitHub Action that reads in the details from a GitHub Action's `action.yml` file and updates the `README.md` file with the `name`, `description`, `usage`, `inputs`, `outputs`, and examples of the action. Configuration can be provid
46 lines • 1.59 kB
JavaScript
import LogTask from '../logtask/index.js';
import updateBadges from './update-badges.js';
import updateBranding from './update-branding.js';
import updateDescription from './update-description.js';
import updateInputs from './update-inputs.js';
import updateOutputs from './update-outputs.js';
import updateTitle from './update-title.js';
import updateUsage from './update-usage.js';
const log = new LogTask('updateSection');
export default async function updateSection(section, inputs) {
const [startToken, stopToken] = inputs.readmeEditor.getTokenIndexes(section);
// &&
// ['branding', 'title'].includes(section) &&
// inputs.config.get('branding_as_title_prefix') !== true
if (startToken === -1 || stopToken === -1) {
return {};
}
switch (section) {
case 'branding': {
return updateBranding(section, inputs);
}
case 'badges': {
return updateBadges(section, inputs);
}
case 'usage': {
return updateUsage(section, inputs);
}
case 'title': {
return updateTitle(section, inputs);
}
case 'description': {
return updateDescription(section, inputs);
}
case 'inputs': {
return updateInputs(section, inputs);
}
case 'outputs': {
return updateOutputs(section, inputs);
}
default: {
log.debug(`unknown section found <!-- start ${section} -->. No updates were made.`);
return {};
}
}
}
//# sourceMappingURL=index.js.map