Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ spacing-level|Number of spaces for formatted files|`2`
branch-name|Default branch name to push changes if not repo-token is provided|*Release target branch*
author-name|Commit author name|*Release author name*
author-email|Commit author email|*Release author email*
swagger|To support swagger openapi structure|`null`

## 👋 Support

Expand Down
13 changes: 13 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const run = async () => {
let branch = core.getInput('branch-name');
let author = core.getInput('author-name');
let email = core.getInput('author-email');
let swagger = core.getInput('swagger');

if (!token && !branch) {
throw new Error('Either repo-token or branch-name must be supplied.');
Expand Down Expand Up @@ -85,6 +86,18 @@ const run = async () => {
const parser = getParser(file, { spacing });
const content = parser.read(buffer);

if (swagger) {
if (content.info.version === version) {
core.info(` - ${file}: Skip since equal versions`);
return change;
}

core.info(` - ${file}: Update version from "${content.info.version}" to "${version}"`);
content.version = version;
fs.writeFileSync(dir, parser.write(content));
return true;
}

if (content.version === version) {
core.info(` - ${file}: Skip since equal versions`);
return change;
Expand Down