Skip to content

Commit b7773e3

Browse files
committed
Work CI-CD
- Add working directory for tasks updating the readme's. - Change find start point for repo directory.
1 parent 26dcf16 commit b7773e3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

azure-pipelines.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,23 @@ steps:
127127

128128
- task: DotNetCoreCLI@2
129129
displayName: Adjust READMEs
130-
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''))
130+
condition: >-
131+
and(
132+
succeeded(),
133+
eq(variables['System.PullRequest.PullRequestId'], '')
134+
)
131135
inputs:
132136
command: custom
133137
custom: run
134138
projects: '**/device-listing.csproj'
139+
workingDirectory: 'nanoFramework.IoT.Device'
135140

136141
- task: PowerShell@2
137142
condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''))
138143
displayName: Push READMEs to GitHub
139144
continueOnError: true
140145
inputs:
141-
workingDirectory: nanoFramework.IoT.Device
146+
workingDirectory: 'nanoFramework.IoT.Device'
142147
targetType: 'inline'
143148
script: |
144149
git config user.email '[email protected]'

src/device-listing/Program.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@
124124
"Interop",
125125
};
126126

127-
string? repoRoot = FindRepoRoot(Environment.CurrentDirectory);
127+
var repoRootPath = Path.Combine(Environment.GetEnvironmentVariable("BUILD_SOURCESDIRECTORY"), "nanoFramework.IoT.Device");
128+
129+
Console.WriteLine($"Finding repository root. Starting point is: {repoRootPath}");
130+
131+
string? repoRoot = CheckRepoRoot(repoRootPath);
128132

129133
if (repoRoot is null)
130134
{
@@ -252,7 +256,7 @@ string GetCategorizedDeviceListing(string devicesPath, IEnumerable<DeviceInfo> d
252256
return deviceListing.ToString();
253257
}
254258

255-
string? FindRepoRoot(string dir)
259+
string? CheckRepoRoot(string dir)
256260
{
257261
if (dir is { Length: > 0 })
258262
{
@@ -263,7 +267,7 @@ string GetCategorizedDeviceListing(string devicesPath, IEnumerable<DeviceInfo> d
263267
else
264268
{
265269
DirectoryInfo? parentDir = new DirectoryInfo(dir).Parent;
266-
return parentDir?.FullName == null ? null : FindRepoRoot(parentDir.FullName);
270+
return parentDir?.FullName == null ? null : CheckRepoRoot(parentDir.FullName);
267271
}
268272
}
269273

0 commit comments

Comments
 (0)