Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit c08e192

Browse files
committed
Adds more logging for opening PRs
1 parent 7767b02 commit c08e192

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

NugetUpdate/NugetUpdate.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Product>NugetPackageUpdates</Product>
1010
<AssemblyName>NugetPackageUpdates</AssemblyName>
1111
<RootNamespace>NugetPackageUpdates</RootNamespace>
12-
<Version>1.0.20</Version>
12+
<Version>1.0.21</Version>
1313
<LangVersion>8</LangVersion>
1414
</PropertyGroup>
1515

NugetUpdate/Repositories/Github.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public async Task SubmitPR(ChangeSet changeSet, string[] reviewers)
111111

112112
var messageLines = changeSet.Message.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
113113

114-
_log.WriteLine("Opening PR");
114+
_log.Write("Opening PR...");
115115

116116
var newPr = new
117117
{
@@ -125,8 +125,13 @@ public async Task SubmitPR(ChangeSet changeSet, string[] reviewers)
125125
$"/repos/{_owner}/{_project}/pulls",
126126
new StringContent(JsonConvert.SerializeObject(newPr), Encoding.UTF8, "application/json"));
127127

128-
var prContentStr = await prResult.Content.ReadAsStringAsync();
128+
if (!prResult.IsSuccessStatusCode)
129+
{
130+
var prContentStr = await prResult.Content.ReadAsStringAsync();
131+
_log.WriteLine($"failed to create PR :( {Environment.NewLine} {prContentStr}");
132+
}
129133

134+
_log.WriteLine("OK");
130135
}
131136

132137
public async Task<ProjectFile> GetProjectFile(string projectPath)
@@ -167,7 +172,7 @@ public async Task<ICollection<string>> FindProjectFiles()
167172

168173
var content = JsonConvert.DeserializeObject<dynamic>(value);
169174

170-
while (content.items.Count > 0)
175+
while (content.items.Count > 0)
171176
{
172177
foreach (dynamic item in content.items)
173178
{
@@ -176,14 +181,14 @@ public async Task<ICollection<string>> FindProjectFiles()
176181
results.Add((string)item.path);
177182
}
178183
}
179-
184+
180185
page++;
181186
response = await _client.GetAsync($"{path}&page={page}");
182187
value = await response.Content.ReadAsStringAsync();
183188

184189
content = JsonConvert.DeserializeObject<dynamic>(value);
185190
}
186-
191+
187192
return results;
188193
}
189194
}

0 commit comments

Comments
 (0)