mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 16:11:05 +01:00
Repository API model now contains GitHub repo owner and name
This commit is contained in:
@@ -23,9 +23,14 @@ namespace Tgstation.Server.Api.Models
|
||||
public RevisionInformation RevisionInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the repository was cloned from GitHub.com. If <see langword="true"/> this enables test merge functionality
|
||||
/// If the repository was cloned from GitHub.com this will be set with the owner of the repository
|
||||
/// </summary>
|
||||
public bool? IsGitHub { get; set; }
|
||||
public string GitHubOwner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the repository was cloned from GitHub.com this will be set with the name of the repository
|
||||
/// </summary>
|
||||
public string GitHubName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="Job"/> started by the <see cref="Repository"/> if any
|
||||
|
||||
@@ -94,7 +94,11 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
static async Task<bool> PopulateApi(Repository model, Components.Repository.IRepository repository, IDatabaseContext databaseContext, Models.Instance instance, CancellationToken cancellationToken)
|
||||
{
|
||||
model.IsGitHub = repository.IsGitHubRepository;
|
||||
if (repository.IsGitHubRepository)
|
||||
{
|
||||
model.GitHubOwner = repository.GitHubOwner;
|
||||
model.GitHubName = repository.GitHubRepoName;
|
||||
}
|
||||
model.Origin = repository.Origin;
|
||||
model.Reference = repository.Reference;
|
||||
|
||||
@@ -187,7 +191,6 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
api.Origin = model.Origin;
|
||||
api.Reference = model.Reference;
|
||||
api.IsGitHub = model.Origin.ToUpperInvariant().Contains(uiGitHub);
|
||||
api.ActiveJob = job.ToApi();
|
||||
|
||||
return StatusCode((int)HttpStatusCode.Created, api);
|
||||
|
||||
Reference in New Issue
Block a user