Skip to content

Commit f4e3e95

Browse files
authored
Merge pull request microsoft#667 from Microsoft/ianc/minor-fix-to-ci-rush
Minor fix to ci-rush to correctly detect environment variables.
2 parents 9ac24c1 + 198074f commit f4e3e95

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

apps/rush-lib/src/scripts/ci-rush.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ if (!installedVersionValid || installedVersion !== expectedVersion) {
131131
const resultLines: string[] = [];
132132
// Trim out lines that reference environment variables that aren't defined
133133
for (const line of npmrcFileLines) {
134-
const environmentVariables: string[] | null = line.match(/\$\{([^\}]+)\}/g);
134+
const regex: RegExp = /\$\{([^\}]+)\}/g; // This finds environment varible tokens that look like "${VAR_NAME}"
135+
const environmentVariables: string[] | null = line.match(regex);
135136
let lineShouldBeTrimmed: boolean = false;
136137
if (environmentVariables) {
137-
for (const environmentVariable of environmentVariables) {
138-
if (!process.env[environmentVariable]) {
138+
for (const token of environmentVariables) {
139+
// Remove the leading "${" and the trailing "}" from the token
140+
const environmentVariableName: string = token.substring(2, token.length - 1);
141+
if (!process.env[environmentVariableName]) {
139142
lineShouldBeTrimmed = true;
140143
break;
141144
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Minor fix to the ci-rush script.",
5+
"packageName": "@microsoft/rush",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "iclanton@users.noreply.github.com"
11+
}

common/scripts/ci-rush.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)