Release script: Commit and push after updating dependents count (#9183)

* Modify to commit and push to remote after updating dependendts count

* Fix typo
This commit is contained in:
Sosuke Suzuki authored and GitHub committed 2020-09-12 03:49:44 +09:00
1 parent 40aedc3905
commit 10a8eff02b
1 file changed
+19
@@ -2,6 +2,7 @@
const chalk = require("chalk");
const fetch = require("node-fetch");
const execa = require("execa");
const { logPromise, processFile } = require("../utils");
async function update() {
@@ -51,6 +52,24 @@ async function update() {
`$1${formatNumber(dependentsCountGithub)}$3`
)
);
const isUpdated = await logPromise(
"Checking if dependents count has been updated",
execa("git", ["diff", "--name-only"]).then(
({ stdout }) => stdout === "website/pages/en/index.js"
)
);
if (isUpdated) {
logPromise(
"Committing and pushing to remote",
(async () => {
await execa("git", ["add", "."]);
await execa("git", ["commit", "-m", "Update dependents count"]);
await execa("git", ["push"]);
})()
);
}
}
function formatNumber(value) {