Dry runs? Pls...

This commit is contained in:
2026-05-23 22:11:36 +02:00
parent e275422b91
commit 025995815d
4 changed files with 115 additions and 3 deletions
+14 -1
View File
@@ -200,7 +200,12 @@ func DeployWikiWithOptions(p *project.Project, opts DeployWikiOptions, progress
if opts.Version != "" {
summary = fmt.Sprintf("%s (%s)", summary, opts.Version)
}
for _, plan := range orderNodeBBDeployPlans(plans) {
orderedPlans := orderNodeBBDeployPlans(plans)
progress(fmt.Sprintf("Executing NodeBB wiki actions: total %d, create %d, update %d, rename %d, archive %d, purge %d", len(orderedPlans), result.Created, result.Updated, result.Renamed, result.Archived, result.Purged))
for i, plan := range orderedPlans {
if shouldReportNodeBBDeployActionProgress(i, len(orderedPlans)) {
progress(fmt.Sprintf("Executing NodeBB wiki action %d/%d: %s %s", i+1, len(orderedPlans), plan.Action, plan.Page.PageID))
}
switch plan.Action {
case "create":
created, err := client.createTopic(plan.Entry.CID, plan.Page.Title, plan.Content, summary)
@@ -246,6 +251,14 @@ func DeployWikiWithOptions(p *project.Project, opts DeployWikiOptions, progress
return result, nil
}
func shouldReportNodeBBDeployActionProgress(index, total int) bool {
if total <= 0 {
return false
}
position := index + 1
return position == 1 || position == total || position%100 == 0
}
func orderNodeBBDeployPlans(plans []wikiDeployPlan) []wikiDeployPlan {
if len(plans) <= 1 {
return plans