From 45a68faadcf7d7df2ee2315a4496fce9ce8c6d4f Mon Sep 17 00:00:00 2001 From: Jan Bronicki Date: Thu, 5 Mar 2026 17:14:29 +0100 Subject: [PATCH 1/2] fix: prevent race conditions by creating new objects for repository configurations Signed-off-by: Jan Bronicki --- lib/plugins/repository.js | 1 + lib/settings.js | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/plugins/repository.js b/lib/plugins/repository.js index 14599f608..eb0b2a852 100644 --- a/lib/plugins/repository.js +++ b/lib/plugins/repository.js @@ -7,6 +7,7 @@ const ignorableFields = [ 'id', 'node_id', 'full_name', + 'name', 'private', 'fork', 'created_at', diff --git a/lib/settings.js b/lib/settings.js index 8d9e07b2b..59a615419 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -327,11 +327,11 @@ ${this.results.reduce((x, y) => { async updateRepos (repo) { this.subOrgConfigs = this.subOrgConfigs || await this.getSubOrgConfigs() - // Keeping this as is instead of doing an object assign as that would cause `Cannot read properties of undefined (reading 'startsWith')` error - // Copilot code review would recoommend using object assign but that would cause the error + // Create a new object to avoid mutating the shared this.config.repository + // This prevents race conditions when multiple repos are processed concurrently via Promise.all let repoConfig = this.config.repository if (repoConfig) { - repoConfig = Object.assign(repoConfig, { name: repo.repo, org: repo.owner }) + repoConfig = Object.assign({}, repoConfig, { name: repo.repo, org: repo.owner }) } const subOrgConfig = this.getSubOrgConfig(repo.repo) @@ -347,7 +347,8 @@ ${this.results.reduce((x, y) => { if (subOrgConfig) { let suborgRepoConfig = subOrgConfig.repository if (suborgRepoConfig) { - suborgRepoConfig = Object.assign(suborgRepoConfig, { name: repo.repo, org: repo.owner }) + // Create a new object to avoid mutating the shared subOrgConfig.repository + suborgRepoConfig = Object.assign({}, suborgRepoConfig, { name: repo.repo, org: repo.owner }) repoConfig = this.mergeDeep.mergeDeep({}, repoConfig, suborgRepoConfig) } } From 23b4be7fac47a31275db1e06f484e85c1360b8a2 Mon Sep 17 00:00:00 2001 From: Jan Bronicki Date: Thu, 5 Mar 2026 17:31:31 +0100 Subject: [PATCH 2/2] Update lib/plugins/repository.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/plugins/repository.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/plugins/repository.js b/lib/plugins/repository.js index eb0b2a852..14599f608 100644 --- a/lib/plugins/repository.js +++ b/lib/plugins/repository.js @@ -7,7 +7,6 @@ const ignorableFields = [ 'id', 'node_id', 'full_name', - 'name', 'private', 'fork', 'created_at',