Skip to content

Commit

Permalink
♻️ Add commit to trigger semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 24, 2020
1 parent 3c6fd4e commit bc90d49
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const updateDependencies = async () => {
const config = await getConfig();
const octokit = await getOctokit();

let changes = 0;

await ensureDir(join(".", ".github", "workflows"));
const workflows = (await readdir(join(".", ".github", "workflows"))).filter(
(file) => file.endsWith(".yml") || file.endsWith(".yaml")
Expand Down Expand Up @@ -42,11 +44,7 @@ export const updateDependencies = async () => {
contents = contents.replace(pkgOldVersion, uses[pkgOldVersion]);
await writeFile(join(".", ".github", "workflows", workflow), contents);
}
console.log(
`:arrow_up: Bump ${pkgName} from ${pkgOldVersion.split("@")[1]} to ${
uses[pkgOldVersion].split("@")[1]
}`
);
if (pkgOldVersion.split("@")[1] !== uses[pkgOldVersion].split("@")[1]) changes++;
commit(
`:arrow_up: Bump ${pkgName} from ${pkgOldVersion.split("@")[1]} to ${
uses[pkgOldVersion].split("@")[1]
Expand All @@ -64,4 +62,16 @@ export const updateDependencies = async () => {
);
}
push();

if (changes) {
const contents = await octokit.repos.getContent({ owner, repo, path: "README.md" });
await octokit.repos.createOrUpdateFileContents({
owner,
repo,
path: "README.md",
content: contents.data.content,
sha: contents.data.sha,
message: ":package: Release dependency updates",
});
}
};

0 comments on commit bc90d49

Please sign in to comment.