From bc90d49212c53059f10af053c99f681b3dfb8e07 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 24 Nov 2020 16:10:30 +0530 Subject: [PATCH] :recycle: Add commit to trigger semantic release --- src/dependencies.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/dependencies.ts b/src/dependencies.ts index 19e692b5..2d7eb165 100644 --- a/src/dependencies.ts +++ b/src/dependencies.ts @@ -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") @@ -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] @@ -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", + }); + } };