use super::*;
#[derive(Debug, Default)]
pub struct StageOutputs {
pub github_native_changelog: bool,
pub changelogs: HashMap<String, String>,
pub changelog_header: Option<String>,
pub changelog_footer: Option<String>,
pub post_publish_results: Vec<serde_json::Value>,
}
pub type VerifyGate = std::sync::Arc<dyn Fn(&mut Context) -> anyhow::Result<bool> + Send + Sync>;
impl Context {
pub fn record_publisher_outcome(&mut self, outcome: crate::PublisherOutcome) {
self.pending_outcome = Some(outcome);
}
pub fn take_pending_outcome(&mut self) -> Option<crate::PublisherOutcome> {
self.pending_outcome.take()
}
pub fn record_pending_evidence(&mut self, evidence: crate::PublishEvidence) {
self.pending_evidence = Some(evidence);
}
pub fn take_pending_evidence(&mut self) -> Option<crate::PublishEvidence> {
self.pending_evidence.take()
}
pub fn publish_report(&self) -> Option<&PublishReport> {
self.publish_report.as_ref()
}
pub fn publish_attempted(&self) -> bool {
self.publish_attempted
}
pub fn set_publish_attempted(&mut self) {
self.publish_attempted = true;
}
pub fn set_publish_report(&mut self, r: PublishReport) {
self.publish_report = Some(r);
}
pub fn built_crate_names(&self) -> Option<&std::collections::HashSet<String>> {
self.built_crate_names.as_ref()
}
pub fn set_built_crate_names(&mut self, names: std::collections::HashSet<String>) {
self.built_crate_names = Some(names);
}
pub fn record_tree_mutation(&mut self, rel_path: impl Into<String>) {
self.tree_mutations.insert(rel_path.into());
}
pub fn tree_mutations(&self) -> &std::collections::BTreeSet<String> {
&self.tree_mutations
}
pub fn remember_skip(&self, stage: &str, label: &str, reason: &str) {
self.skip_memento.remember(stage, label, reason);
}
}