Skip to content

Commit

Permalink
record used needs and reviewer in state
Browse files Browse the repository at this point in the history
  • Loading branch information
goaaats committed Oct 3, 2024
1 parent 1c898d7 commit e80e36c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Plogon/BuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,9 @@ await this.dockerClient.Containers.RemoveContainerAsync(containerCreateResponse.
task.Manifest.Plugin.Commit,
version!,
task.Manifest.Plugin.MinimumVersion,
changelog);
changelog,
this.actor ?? throw new Exception("Committing, but actor is null"),
allNeeds.Select(x => (x.Name, x.Version)));

this.CommitReviewedNeeds(allNeeds);

Expand Down
25 changes: 17 additions & 8 deletions Plogon/Repo/PluginRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ public void RemovePlugin(string channelName, string plugin)
/// <param name="effectiveVersion">New version of the plugin</param>
/// <param name="minimumVersion">Minimum version Dalamud should still try to load.</param>
/// <param name="changelog">Plugin changelog</param>
public void UpdatePluginHave(string channelName, string plugin, string haveCommit, string effectiveVersion, string? minimumVersion, string? changelog)
/// <param name="reviewer">Who reviewed this version</param>
/// <param name="needs">Needs we had for this version</param>
public void UpdatePluginHave(
string channelName,
string plugin,
string haveCommit,
string effectiveVersion,
string? minimumVersion,
string? changelog,
string reviewer,
IEnumerable<(string Key, string Version)> needs)
{
if (!this.State.Channels.ContainsKey(channelName))
{
Expand Down Expand Up @@ -138,14 +148,13 @@ public void UpdatePluginHave(string channelName, string plugin, string haveCommi
channel.Plugins[plugin] = pluginState;
}

if (!string.IsNullOrWhiteSpace(changelog))
pluginState.Changelogs[effectiveVersion] = new State.Channel.PluginState.PluginChangelog
{
pluginState.Changelogs[effectiveVersion] = new State.Channel.PluginState.PluginChangelog()
{
Changelog = changelog,
TimeReleased = DateTime.Now,
};
}
Changelog = changelog,
TimeReleased = DateTime.Now,
UsedNeeds = needs.Select(x => new State.Channel.PluginState.PluginChangelog.UsedNeed(x.Key, x.Version)).ToList(),
Reviewer = reviewer,
};

SaveState();
}
Expand Down
9 changes: 8 additions & 1 deletion Plogon/Repo/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ public PluginState()

public Dictionary<string, PluginChangelog> Changelogs { get; set; }

// This should really be "version", but we're stuck with "changelog" for now
public class PluginChangelog
{
public DateTime TimeReleased { get; set; }
public string Changelog { get; set; }
public string? Changelog { get; set; }

public record UsedNeed(string Key, string Version);

public List<UsedNeed>? UsedNeeds { get; set; }

public string Reviewer { get; set; }
}
}

Expand Down

0 comments on commit e80e36c

Please sign in to comment.