Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Remove time ago from build started description #70

Merged
merged 1 commit into from
Dec 9, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions qed/Functions/GetGitHubBuildStatusDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;

namespace qed
{
public static partial class Functions
{
internal static string GetGitHubBuildStatusDescription(Build build)
{
if (build == null) throw new ArgumentNullException("build");

var now = DateTimeOffset.UtcNow;

if (!build.Started.HasValue)
return String.Format("Build #{0} queued.", build.Id);

if (!build.Finished.HasValue)
return String.Format("Build #{0} started.", build.Id);

if (!build.Succeeded.HasValue)
return String.Format("Build #{0} finished in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));

if (build.Succeeded.Value)
return String.Format("Build #{0} succeeded in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));

return String.Format("Build #{0} failed in {1} seconds.", build.Id, build.Started.Value.Until(build.Finished.Value));
}
}
}
2 changes: 1 addition & 1 deletion qed/Functions/SetGitHubBuildStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void SetGitHubBuildStatus(
build,
state,
GetBuildConfiguration,
GetBuildDescription,
GetGitHubBuildStatusDescription,
GetHost,
(token, owner, name, sha, commitState, targetUrl, description) =>
{
Expand Down
1 change: 1 addition & 0 deletions qed/qed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Functions\CompareToPasswordHash.cs" />
<Compile Include="Functions\GetGitHubBuildStatusDescription.cs" />
<Compile Include="Functions\FailTimedOutBuilds.cs" />
<Compile Include="Functions\ToDictionary.cs" />
<Compile Include="Functions\GeneratePasswordHash.cs" />
Expand Down