Skip to content

Commit

Permalink
feat: add ci argument to fail if a badge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
troypoulter committed Oct 8, 2021
1 parent f70c835 commit 57de3d6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/editor.ts
Expand Up @@ -79,7 +79,14 @@ export const getNewReadme =
const valueToChangeIndex = valueToChangeStart.indexOf(')');
const valueToChangeFinal = valueToChangeStart.substring(1, valueToChangeIndex);

newReadmeFile = newReadmeFile.replace(enpatterned(valueToChangeFinal), enpatterned(coverageBadge as string));
const oldBadge = enpatterned(valueToChangeFinal);
const newBadge = enpatterned(coverageBadge as string);

if (getArgumentValue('ci') && oldBadge !== newBadge) {
reject("The coverage badge has changed, which isn't allowed with the `ci` argument");
}

newReadmeFile = newReadmeFile.replace(oldBadge, newBadge);
});

resolve(newReadmeFile);
Expand Down

0 comments on commit 57de3d6

Please sign in to comment.