From d9282e73fdca3cb617e4eeaa7988ec80c72e3e97 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Tue, 1 Jun 2021 21:45:59 +0100 Subject: [PATCH] feat: allow same repository with different branches --- src/config.js | 13 +++++++------ src/git.js | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/config.js b/src/config.js index 5c9e0fa6..17dd62b7 100644 --- a/src/config.js +++ b/src/config.js @@ -112,6 +112,7 @@ const parseRepoName = (fullRepo) => { return { fullName: `${ host }/${ user }/${ name }`, + uniqueName: `${ host }/${ user }/${ name }@${ branch }`, host, user, name, @@ -171,12 +172,12 @@ const parseConfig = async () => { const files = parseFiles(group.files) const repo = parseRepoName(name) - if (result[repo.fullName] !== undefined) { - result[repo.fullName].files.push(...files) + if (result[repo.uniqueName] !== undefined) { + result[repo.uniqueName].files.push(...files) return } - result[repo.fullName] = { + result[repo.uniqueName] = { repo, files } @@ -186,12 +187,12 @@ const parseConfig = async () => { const files = parseFiles(configObject[key]) const repo = parseRepoName(key) - if (result[repo.fullName] !== undefined) { - result[repo.fullName].files.push(...files) + if (result[repo.uniqueName] !== undefined) { + result[repo.uniqueName].files.push(...files) return } - result[repo.fullName] = { + result[repo.uniqueName] = { repo, files } diff --git a/src/git.js b/src/git.js index 333afe4a..c6768a51 100644 --- a/src/git.js +++ b/src/git.js @@ -54,7 +54,7 @@ class Git { // Set values to current repo this.repo = repo - this.workingDir = path.join(TMP_DIR, repo.fullName) + this.workingDir = path.join(TMP_DIR, repo.uniqueName) this.gitUrl = `https://${ GITHUB_TOKEN }@${ repo.fullName }.git` await this.clone()