From 579de2518f01bb8c2f6d820dd2df93d23894b412 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Thu, 8 Sep 2022 23:42:07 +0200 Subject: [PATCH] feat(script): skip repositories named '.github' (#35) --- script.js | 8 ++++++++ script.test.js | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/script.js b/script.js index 7255a68..055bb41 100644 --- a/script.js +++ b/script.js @@ -28,6 +28,14 @@ export async function script(octokit, repository, options) { return; } + if (repository.name === ".github") { + octokit.log.info( + { owner, repo, updated: false }, + `${repository.name} is a blacklisted repository name. No changed applied.` + ); + return; + } + let currentExtends; const { diff --git a/script.test.js b/script.test.js index 50478e6..fdcd6e1 100644 --- a/script.test.js +++ b/script.test.js @@ -438,6 +438,24 @@ test("returns if repository is archived", async () => { equal(nock.pendingMocks().length, 0); }); +test("returns if repository is named '.github'", async () => { + const dotGithubRepo = { + ...repository, + name: ".github", + full_name: "octocat/.github", + }; + + try { + await script(getOctokitForTests(), dotGithubRepo, { + extends: "github>octoherd/.github", + }); + } catch (error) { + unreachable("should have NOT thrown"); + } + + equal(nock.pendingMocks().length, 0); +}); + test("creates JSON file if file does NOT exist in the repository", async () => { const path = "renovate.json";