Skip to content

Commit ab4ddaf

Browse files
authored
Merge pull request GitTools#2877 from nils-a/feature/GitToolsGH-2876
[Feature] Do not fail AppVeyor builds on force-push
1 parent 4e4bd86 commit ab4ddaf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/GitVersion.Core/BuildAgents/AppVeyor.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ public override string GenerateSetVersionMessage(VersionVariables variables)
2727
};
2828

2929
var stringContent = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
30-
var response = httpClient.PutAsync("api/build", stringContent).GetAwaiter().GetResult();
31-
response.EnsureSuccessStatusCode();
30+
31+
try
32+
{
33+
var response = httpClient.PutAsync("api/build", stringContent).GetAwaiter().GetResult();
34+
response.EnsureSuccessStatusCode();
35+
}
36+
catch (Exception ex)
37+
{
38+
return $"Failed to set AppVeyor build number to '{variables.FullSemVer}'. The error was: {ex.Message}";
39+
}
3240

3341
return $"Set AppVeyor build number to '{variables.FullSemVer}'.";
3442
}

0 commit comments

Comments
 (0)