Skip to content

Commit 6017917

Browse files
feat(test_downstream_projects): add branch selection support for downstream git repositories
1 parent 554c21f commit 6017917

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

actions/upgrade/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
required: true
1111
default: 'false'
1212
excludes:
13-
description: 'packages to exclude'
13+
description: 'comma separated list of packages to exclude from upgrades'
1414
required: false
1515
outputs:
1616
upgrades: # id of output

test_downstream_projects.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,15 @@ function fetchDownstreamProjects(downstreamConfig, prefix, downstreamTreeNode) {
159159
const installSource = downstreamConfig[key];
160160
const isFile = /^\./.exec(installSource);
161161
const installSourcePath = prefix ? path.resolve(DOWNSTREAM_CACHE, prefix, installSource) : path.resolve(PKG_DIR, installSource);
162-
const installSourceForYalc = isFile ? './' + path.relative(process.cwd(), installSourcePath) : installSource;
162+
const installSourceNormalized = isFile ? './' + path.relative(process.cwd(), installSourcePath) : installSource;
163+
// Extract optional git repo branch, i.e.: https://github.com/ui-router/core.git@somebranch
164+
const [orig, gitRepoOnly, branch] = /^(.*?)(?:\.git@(.*))?$/.exec(installSourceNormalized);
165+
const installSourceForYalc = branch ? gitRepoOnly : orig;
163166
const flags = { noBuild: true, noPublish: true, noInstall: true };
167+
if (branch) {
168+
flags.branch = `origin/${branch}`;
169+
}
170+
164171
publishYalcPackage(path.resolve(DOWNSTREAM_CACHE, installDir), installSourceForYalc, flags);
165172

166173
const children = {};

0 commit comments

Comments
 (0)