@intentius/chant 0.124.87 → 0.124.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +47 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +56 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +203 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-commit.d.ts +1 -1
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +128 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +203 -0
- package/dist/ci-evidence-jobs.d.ts +68 -4
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +82 -5
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +65 -10
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +101 -22
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +62 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +52 -1
- package/dist/ci-product.d.ts +52 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +51 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +37 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +255 -20
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +11 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +71 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +97 -14
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +36 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +60 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +82 -0
- package/dist/cli/registry.d.ts +35 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +18 -0
- package/dist/components/pr-checks.d.ts +169 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +180 -0
- package/dist/components/pr-pipeline.d.ts +38 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +6 -1
- package/dist/components/product-pipeline.d.ts +58 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +76 -9
- package/dist/components/product-plan.d.ts +445 -7
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +426 -15
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +52 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +46 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +81 -21
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +19 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +8 -2
- package/dist/forge-check/index.d.ts +4 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +4 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -0
- package/dist/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +88 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +248 -0
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +27 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +26 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +76 -4
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +26 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +118 -0
- package/dist/op/op-waves-evidence.d.ts +12 -1
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +23 -2
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +14 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +56 -4
- package/dist/op/op-waves.d.ts +12 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +14 -1
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +148 -10
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +121 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +104 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +68 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +218 -13
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +90 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +155 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +100 -16
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +101 -17
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts +24 -1
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -4
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +307 -297
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +15 -8
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +27 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +52 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +28 -8
- package/dist/workspace/trust/check-evidence.d.ts +13 -1
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +8 -3
- package/dist/workspace/trust/evidence.d.ts +5 -0
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- package/dist/workspace/trust/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +93 -11
- package/dist/workspace/trust/ref-gate.d.ts +61 -2
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +72 -7
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/action-pins.ts +2 -0
- package/src/actor.test.ts +78 -0
- package/src/actor.ts +79 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +108 -1
- package/src/chant-install.ts +242 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +51 -6
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +165 -0
- package/src/ci-evidence-from-job.ts +251 -0
- package/src/ci-evidence-jobs.ts +88 -6
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +187 -16
- package/src/ci-image.ts +157 -25
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +89 -0
- package/src/ci-product.ts +62 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +37 -7
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +233 -18
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +69 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +93 -15
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +35 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +60 -4
- package/src/cli/parse-args.ts +58 -0
- package/src/cli/registry.ts +35 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/check-hooks.ts +22 -0
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/pr-checks.ts +254 -0
- package/src/components/pr-pipeline.ts +43 -1
- package/src/components/product-pipeline.ts +113 -9
- package/src/components/product-plan.test.ts +140 -1
- package/src/components/product-plan.ts +707 -20
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +45 -0
- package/src/drift-record.ts +71 -6
- package/src/floor-table.data.ts +81 -21
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +23 -2
- package/src/forge-check/forge-check.test.ts +25 -0
- package/src/forge-check/index.ts +4 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +118 -0
- package/src/generated-check.test.ts +170 -0
- package/src/generated-check.ts +310 -0
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +28 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +87 -4
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +100 -0
- package/src/lifecycle/release-images.ts +38 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +140 -0
- package/src/op/op-waves-evidence.test.ts +36 -3
- package/src/op/op-waves-evidence.ts +23 -3
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +59 -3
- package/src/op/op-waves.ts +16 -2
- package/src/op/schedule-overdue.test.ts +126 -1
- package/src/op/schedule-overdue.ts +164 -12
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +184 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +32 -1
- package/src/pr-post.ts +254 -15
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +208 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +139 -17
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +89 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -4
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +14 -7
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +104 -3
- package/src/workspace/release-workflow.ts +60 -9
- package/src/workspace/trust/check-evidence-report.ts +39 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/check-evidence.ts +17 -5
- package/src/workspace/trust/evidence.ts +5 -0
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/ref-gate-cli.ts +88 -10
- package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/trust/ref-gate.ts +87 -6
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The comment job on GitHub and Forgejo (#4946): one job that reads every
|
|
3
|
+
* `/<product>` comment and answers the ones no other job of the pipeline
|
|
4
|
+
* takes, the GitHub and Forgejo half of what the GitLab note poll does
|
|
5
|
+
* (./ci-note-commands.ts). Moved from terragucci's `decideComment` and
|
|
6
|
+
* `decideApplyComment` (comment.ts, comment-apply.ts).
|
|
7
|
+
*
|
|
8
|
+
* GitHub and Forgejo start a workflow on the comment itself, so each job
|
|
9
|
+
* that answers a command (the re-plan, the comment lock and unlock, the
|
|
10
|
+
* action job, the agent, the commit jobs, the apply before merge) starts on
|
|
11
|
+
* its own comment, and this job leaves those comments alone. It answers the
|
|
12
|
+
* rest:
|
|
13
|
+
*
|
|
14
|
+
* - a comment the grammar refuses (`parseProductComment` with
|
|
15
|
+
* `leaveCommit`, so a commit word stays the commit job's), with the
|
|
16
|
+
* grammar's reason, an alias's product reason among them
|
|
17
|
+
* (`CiProductAlias.refuse`);
|
|
18
|
+
* - a command no job runs (`plan`, `apply`, `lock`, `unlock`, `action`,
|
|
19
|
+
* `agent`), with the words' reply for it (`words.replies`) or chant's;
|
|
20
|
+
* - with `applyOnMerge`, `/<product> apply` on a merged pull request: the
|
|
21
|
+
* newest push run at its merge commit that has an apply job is started
|
|
22
|
+
* again, unless a later commit of the default branch already carries the
|
|
23
|
+
* product's apply status. On GitHub the run's failed jobs run again
|
|
24
|
+
* (`rerun-failed-jobs`), each wave behind its own gate. Forgejo has no
|
|
25
|
+
* call that runs a run again, so the waves workflow is dispatched on the
|
|
26
|
+
* default branch, and only while the merge commit is still the branch's
|
|
27
|
+
* newest push. A forge re-run cannot stop the waves after one, so with
|
|
28
|
+
* the waves' op (`jobs.waves`, #4979) a `wave-<n>` writes a stop for the
|
|
29
|
+
* merge commit on `chant/lifecycle` before the run starts, and the waves
|
|
30
|
+
* after n wait (./op/wave-stop.ts); without it a wave-n is refused. On a
|
|
31
|
+
* fork, a pull request merged elsewhere, or one closed without merging,
|
|
32
|
+
* the reply says so.
|
|
33
|
+
* - with `noPlanFlags` (#4979), a plan comment with flags the product
|
|
34
|
+
* plan's re-plan cannot take, with the reason.
|
|
35
|
+
*
|
|
36
|
+
* Who asked comes first. On GitHub the commenter's permission is read from
|
|
37
|
+
* the forge; Forgejo answers 403 when a job's token asks for another user's
|
|
38
|
+
* permission, so there the event's `repository.permissions`, computed for
|
|
39
|
+
* the comment's author when the comment was created, is read, and the
|
|
40
|
+
* event must be for this repository and from the comment's author. Someone
|
|
41
|
+
* without write access gets no reply and nothing runs, as on GitLab.
|
|
42
|
+
*
|
|
43
|
+
* The comment is untrusted input: it is read from the event file, never
|
|
44
|
+
* from an expression in a script, and nothing of it reaches a shell. The
|
|
45
|
+
* job runs at the target branch's commit, so none of the change's code
|
|
46
|
+
* runs here.
|
|
47
|
+
*/
|
|
48
|
+
import { type ApplyRerun, type ChantNoteJobs, type StartedRun } from "./ci-note-commands.js";
|
|
49
|
+
import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
|
|
50
|
+
import { type ForgeFetch, type PrForge } from "./pr-forge.js";
|
|
51
|
+
import type { ForgeReads } from "./pr-forge-reads.js";
|
|
52
|
+
/** The comment job's name in a generated workflow (#4946). */
|
|
53
|
+
export declare const PR_COMMENT_JOB = "comment";
|
|
54
|
+
/** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
|
|
55
|
+
export declare const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
|
|
56
|
+
/**
|
|
57
|
+
* The jobs the pipeline has that answer a comment (#4946), so the comment
|
|
58
|
+
* job leaves their comments to them. `preview` is any job that plans on the
|
|
59
|
+
* plan comment (the product plan's re-plan, or the comment preview).
|
|
60
|
+
*/
|
|
61
|
+
export interface CommentJobs extends Omit<ChantNoteJobs, "members"> {
|
|
62
|
+
/** The action command is answered by a workflow: the product's own, or the pipeline's action job. */
|
|
63
|
+
actions?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The product plan's targets, with its re-plan: a plan comment naming
|
|
66
|
+
* another is skipped by every re-plan job without a word, so the comment
|
|
67
|
+
* job replies with the words' `member` sentence.
|
|
68
|
+
*/
|
|
69
|
+
targets?: readonly string[];
|
|
70
|
+
/** The product plan's re-plan skips a fork's pull request (`forks: "skip"`) without a word, so the comment job replies with the words' `fork` sentence. */
|
|
71
|
+
skipForks?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The plan comment's job is the product plan's re-plan (#4979), which
|
|
74
|
+
* takes at most one word after the command and no flags: a plan comment
|
|
75
|
+
* with `--target`, `--refresh` or `--target-dependents` gets a reply that
|
|
76
|
+
* says so, where the re-plan would skip it without a word.
|
|
77
|
+
*/
|
|
78
|
+
noPlanFlags?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The waves on merge (#4979): the op they run as and how many there are.
|
|
81
|
+
* With them a merged pull request's `/<product> apply wave-<n>` runs the
|
|
82
|
+
* apply again and stops after wave n: the job writes the stop on
|
|
83
|
+
* `chant/lifecycle` for the merge commit (./op/wave-stop.ts) before it
|
|
84
|
+
* starts the run, and each later wave waits. An apply without a wave
|
|
85
|
+
* clears it.
|
|
86
|
+
*/
|
|
87
|
+
waves?: {
|
|
88
|
+
op: string;
|
|
89
|
+
count: number;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Writes a wave stop for op `op` at `sha` on `chant/lifecycle`, or clears it (#4979). */
|
|
93
|
+
export type CommentWaveStops = (op: string, sha: string, stop: {
|
|
94
|
+
through: number;
|
|
95
|
+
at: string;
|
|
96
|
+
by?: string;
|
|
97
|
+
pr?: number;
|
|
98
|
+
} | null) => Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* The apply jobs a re-run looks for at a merge commit: chant's op waves
|
|
101
|
+
* (`wave-<k>-<name>`, its decide and share jobs) and chant's and
|
|
102
|
+
* terragucci's pull request loop jobs (`apply`, `apply-wave-<k>`).
|
|
103
|
+
*/
|
|
104
|
+
export declare const RERUN_APPLY_JOBS: RegExp;
|
|
105
|
+
/** The writes a re-run makes, with the job's token. */
|
|
106
|
+
export interface CommentRuns {
|
|
107
|
+
/** GitHub: `POST /repos/{repo}/actions/runs/{run}/rerun-failed-jobs`. */
|
|
108
|
+
rerunFailed(run: number): Promise<StartedRun>;
|
|
109
|
+
/** Forgejo: `POST /repos/{repo}/actions/workflows/{workflow}/dispatches` on `ref`. */
|
|
110
|
+
dispatch(workflow: string, ref: string): Promise<StartedRun>;
|
|
111
|
+
}
|
|
112
|
+
/** The writes for a GitHub or Forgejo API root, repository and token. */
|
|
113
|
+
export declare function commentRuns(opts: {
|
|
114
|
+
apiBase: string;
|
|
115
|
+
repo: string;
|
|
116
|
+
token: string;
|
|
117
|
+
fetch?: ForgeFetch;
|
|
118
|
+
}): CommentRuns;
|
|
119
|
+
/** What {@link answerProductComment} takes. */
|
|
120
|
+
export interface AnswerCommentOptions {
|
|
121
|
+
forge: "github" | "forgejo";
|
|
122
|
+
/** The `issue_comment` event, as the event file has it. */
|
|
123
|
+
event: unknown;
|
|
124
|
+
/** `owner/name`. */
|
|
125
|
+
repo: string;
|
|
126
|
+
reads: ForgeReads;
|
|
127
|
+
/** chant's client, holding the job's token: it posts the reply and reads the statuses. */
|
|
128
|
+
poster: Pick<PrForge, "addComment" | "commitStatuses">;
|
|
129
|
+
runs: CommentRuns;
|
|
130
|
+
words: CiProductWords;
|
|
131
|
+
/** The default branch. */
|
|
132
|
+
base: string;
|
|
133
|
+
jobs: CommentJobs;
|
|
134
|
+
/** The job's environment, for the words' aliases. */
|
|
135
|
+
env?: Record<string, string | undefined>;
|
|
136
|
+
/** The commit words that take an argument, as `parseProductComment` takes them. */
|
|
137
|
+
commitArgs?: Readonly<Record<string, RegExp>>;
|
|
138
|
+
/** With `jobs.waves` (#4979): writes the wave stop before a re-run starts. Absent: a `wave-<n>` is refused, as before. */
|
|
139
|
+
stops?: CommentWaveStops;
|
|
140
|
+
/** The time a stop is written at. Default now. */
|
|
141
|
+
now?: () => string;
|
|
142
|
+
}
|
|
143
|
+
/** What the comment job did. */
|
|
144
|
+
export interface CommentOutcome {
|
|
145
|
+
/** The command's kind, when the comment parsed as one. */
|
|
146
|
+
command?: string;
|
|
147
|
+
/** True when a run was started again. */
|
|
148
|
+
ran: boolean;
|
|
149
|
+
/** True when the job posted a reply. */
|
|
150
|
+
replied: boolean;
|
|
151
|
+
/** True when something broke (a forge answer), not because the comment asked for nothing. The command exits non-zero on it. */
|
|
152
|
+
fail?: boolean;
|
|
153
|
+
reason: string;
|
|
154
|
+
url?: string;
|
|
155
|
+
}
|
|
156
|
+
/** The command a comment asks for, for a job that only needs to know: the grammar's reading, leaving a commit word to the commit job. */
|
|
157
|
+
export declare function readProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>): ParsedProductComment | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Whether another job of the pipeline answers `parsed` on an open or a
|
|
160
|
+
* merged pull request, so the comment job says nothing (#4946).
|
|
161
|
+
*/
|
|
162
|
+
export declare function answeredElsewhere(parsed: Exclude<ParsedProductComment, {
|
|
163
|
+
kind: "refused";
|
|
164
|
+
}>, jobs: CommentJobs, open: boolean | undefined): boolean;
|
|
165
|
+
/** Read the comment, and answer it when no other job does (#4946). */
|
|
166
|
+
export declare function answerProductComment(o: AnswerCommentOptions): Promise<CommentOutcome>;
|
|
167
|
+
/** The reply to a plan comment with flags the product plan's re-plan cannot take (#4979). */
|
|
168
|
+
export declare function planFlagsReply(words: CiProductWords): string;
|
|
169
|
+
/** GitHub's start: run the run's failed jobs again, and the jobs that need them. */
|
|
170
|
+
export declare function githubRerun(runs: Pick<CommentRuns, "rerunFailed">): ApplyRerun;
|
|
171
|
+
/**
|
|
172
|
+
* Forgejo's start: Forgejo has no call that runs a run again, so the run's
|
|
173
|
+
* workflow is dispatched on the default branch, which runs its head. That
|
|
174
|
+
* is the merge commit only while no push came after it.
|
|
175
|
+
*/
|
|
176
|
+
export declare function forgejoRerun(runs: Pick<CommentRuns, "dispatch">, reads: Pick<ForgeReads, "branchRuns">): ApplyRerun;
|
|
177
|
+
//# sourceMappingURL=ci-comment-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-comment-commands.d.ts","sourceRoot":"","sources":["../src/ci-comment-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAc,KAAK,UAAU,EAAqB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,kBAAkB,CAAC;AAEtE,8DAA8D;AAC9D,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,oIAAoI;AACpI,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;IACjE,qGAAqG;IACrG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,2JAA2J;IAC3J,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElJ;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAA8H,CAAC;AAE5J,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,yEAAyE;IACzE,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9C,sFAAsF;IACtF,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC9D;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,WAAW,CAcnH;AAED,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,2DAA2D;IAC3D,KAAK,EAAE,OAAO,CAAC;IACf,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,0FAA0F;IAC1F,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,CAAC,CAAC;IACvD,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;IACtB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,mFAAmF;IACnF,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9C,0HAA0H;IAC1H,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,GAAG,EAAE,OAAO,CAAC;IACb,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,+HAA+H;IAC/H,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAUD,yIAAyI;AACzI,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM,EAAE,UAAU,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAAG,oBAAoB,GAAG,SAAS,CAE1M;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAiBnJ;AAED,sEAAsE;AACtE,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAyH3F;AAED,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAI5D;AAcD,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,UAAU,CAY9E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,UAAU,CAqBnH"}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The comment job on GitHub and Forgejo (#4946): one job that reads every
|
|
3
|
+
* `/<product>` comment and answers the ones no other job of the pipeline
|
|
4
|
+
* takes, the GitHub and Forgejo half of what the GitLab note poll does
|
|
5
|
+
* (./ci-note-commands.ts). Moved from terragucci's `decideComment` and
|
|
6
|
+
* `decideApplyComment` (comment.ts, comment-apply.ts).
|
|
7
|
+
*
|
|
8
|
+
* GitHub and Forgejo start a workflow on the comment itself, so each job
|
|
9
|
+
* that answers a command (the re-plan, the comment lock and unlock, the
|
|
10
|
+
* action job, the agent, the commit jobs, the apply before merge) starts on
|
|
11
|
+
* its own comment, and this job leaves those comments alone. It answers the
|
|
12
|
+
* rest:
|
|
13
|
+
*
|
|
14
|
+
* - a comment the grammar refuses (`parseProductComment` with
|
|
15
|
+
* `leaveCommit`, so a commit word stays the commit job's), with the
|
|
16
|
+
* grammar's reason, an alias's product reason among them
|
|
17
|
+
* (`CiProductAlias.refuse`);
|
|
18
|
+
* - a command no job runs (`plan`, `apply`, `lock`, `unlock`, `action`,
|
|
19
|
+
* `agent`), with the words' reply for it (`words.replies`) or chant's;
|
|
20
|
+
* - with `applyOnMerge`, `/<product> apply` on a merged pull request: the
|
|
21
|
+
* newest push run at its merge commit that has an apply job is started
|
|
22
|
+
* again, unless a later commit of the default branch already carries the
|
|
23
|
+
* product's apply status. On GitHub the run's failed jobs run again
|
|
24
|
+
* (`rerun-failed-jobs`), each wave behind its own gate. Forgejo has no
|
|
25
|
+
* call that runs a run again, so the waves workflow is dispatched on the
|
|
26
|
+
* default branch, and only while the merge commit is still the branch's
|
|
27
|
+
* newest push. A forge re-run cannot stop the waves after one, so with
|
|
28
|
+
* the waves' op (`jobs.waves`, #4979) a `wave-<n>` writes a stop for the
|
|
29
|
+
* merge commit on `chant/lifecycle` before the run starts, and the waves
|
|
30
|
+
* after n wait (./op/wave-stop.ts); without it a wave-n is refused. On a
|
|
31
|
+
* fork, a pull request merged elsewhere, or one closed without merging,
|
|
32
|
+
* the reply says so.
|
|
33
|
+
* - with `noPlanFlags` (#4979), a plan comment with flags the product
|
|
34
|
+
* plan's re-plan cannot take, with the reason.
|
|
35
|
+
*
|
|
36
|
+
* Who asked comes first. On GitHub the commenter's permission is read from
|
|
37
|
+
* the forge; Forgejo answers 403 when a job's token asks for another user's
|
|
38
|
+
* permission, so there the event's `repository.permissions`, computed for
|
|
39
|
+
* the comment's author when the comment was created, is read, and the
|
|
40
|
+
* event must be for this repository and from the comment's author. Someone
|
|
41
|
+
* without write access gets no reply and nothing runs, as on GitLab.
|
|
42
|
+
*
|
|
43
|
+
* The comment is untrusted input: it is read from the event file, never
|
|
44
|
+
* from an expression in a script, and nothing of it reaches a shell. The
|
|
45
|
+
* job runs at the target branch's commit, so none of the change's code
|
|
46
|
+
* runs here.
|
|
47
|
+
*/
|
|
48
|
+
import { commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies.js";
|
|
49
|
+
import { retryApply } from "./ci-note-commands.js";
|
|
50
|
+
import { parseProductComment } from "./ci-product-words.js";
|
|
51
|
+
import { ForgeApiError } from "./pr-forge.js";
|
|
52
|
+
/** The comment job's name in a generated workflow (#4946). */
|
|
53
|
+
export const PR_COMMENT_JOB = "comment";
|
|
54
|
+
/** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
|
|
55
|
+
export const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
|
|
56
|
+
/**
|
|
57
|
+
* The apply jobs a re-run looks for at a merge commit: chant's op waves
|
|
58
|
+
* (`wave-<k>-<name>`, its decide and share jobs) and chant's and
|
|
59
|
+
* terragucci's pull request loop jobs (`apply`, `apply-wave-<k>`).
|
|
60
|
+
*/
|
|
61
|
+
export const RERUN_APPLY_JOBS = /^(?:wave-([1-9][0-9]*)-[a-z0-9][a-z0-9_-]*|(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(?:-share-[1-9][0-9]*)?)?)$/;
|
|
62
|
+
/** The writes for a GitHub or Forgejo API root, repository and token. */
|
|
63
|
+
export function commentRuns(opts) {
|
|
64
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
65
|
+
const root = `${opts.apiBase.replace(/\/+$/, "")}/repos/${opts.repo}`;
|
|
66
|
+
const post = async (path, body) => {
|
|
67
|
+
const url = `${root}${path}`;
|
|
68
|
+
const res = await fetchImpl(url, { method: "POST", headers: { Authorization: `token ${opts.token}`, Accept: "application/json", "Content-Type": "application/json" }, body: JSON.stringify(body) });
|
|
69
|
+
const text = await res.text();
|
|
70
|
+
if (!res.ok)
|
|
71
|
+
throw new ForgeApiError("POST", url, res.status, text);
|
|
72
|
+
return {};
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
rerunFailed: (run) => post(`/actions/runs/${run}/rerun-failed-jobs`, {}),
|
|
76
|
+
dispatch: (workflow, ref) => post(`/actions/workflows/${encodeURIComponent(workflow)}/dispatches`, { ref }),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** Permissions on GitHub that may ask for a command: the same as may push. */
|
|
80
|
+
const MAY_ASK = new Set(["admin", "maintain", "write"]);
|
|
81
|
+
const LOGIN = /^[A-Za-z0-9_][A-Za-z0-9_.@-]{0,99}$/;
|
|
82
|
+
const short = (sha) => sha.slice(0, 8);
|
|
83
|
+
const message = (e) => (e instanceof Error ? e.message : String(e)).split("\n")[0];
|
|
84
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
85
|
+
/** The command a comment asks for, for a job that only needs to know: the grammar's reading, leaving a commit word to the commit job. */
|
|
86
|
+
export function readProductComment(words, body, env = {}, commitArgs = {}) {
|
|
87
|
+
return parseProductComment(words, body, env, commitArgs, { leaveCommit: true });
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Whether another job of the pipeline answers `parsed` on an open or a
|
|
91
|
+
* merged pull request, so the comment job says nothing (#4946).
|
|
92
|
+
*/
|
|
93
|
+
export function answeredElsewhere(parsed, jobs, open) {
|
|
94
|
+
switch (parsed.kind) {
|
|
95
|
+
case "plan":
|
|
96
|
+
return Boolean(jobs.preview);
|
|
97
|
+
case "lock":
|
|
98
|
+
case "unlock":
|
|
99
|
+
return Boolean(jobs.locks);
|
|
100
|
+
case "action":
|
|
101
|
+
return Boolean(jobs.actions);
|
|
102
|
+
case "agent":
|
|
103
|
+
return Boolean(jobs.agent);
|
|
104
|
+
case "commit":
|
|
105
|
+
return true;
|
|
106
|
+
case "apply":
|
|
107
|
+
// The apply before merge answers an open pull request's apply comment; a merged one's is this job's.
|
|
108
|
+
return Boolean(jobs.applyBeforeMerge) && open !== false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Read the comment, and answer it when no other job does (#4946). */
|
|
112
|
+
export async function answerProductComment(o) {
|
|
113
|
+
const e = o.event;
|
|
114
|
+
const t = commentTerms(o.forge);
|
|
115
|
+
const silent = (reason, command) => ({ ...(command ? { command } : {}), ran: false, replied: false, reason });
|
|
116
|
+
const broke = (reason, command) => ({ ...(command ? { command } : {}), ran: false, replied: false, fail: true, reason });
|
|
117
|
+
if (!isObject(e))
|
|
118
|
+
return broke("the event is not a JSON object");
|
|
119
|
+
if (e.action !== "created")
|
|
120
|
+
return silent("not a new comment");
|
|
121
|
+
const comment = isObject(e.comment) ? e.comment : {};
|
|
122
|
+
const parsed = readProductComment(o.words, comment.body, o.env ?? {}, o.commitArgs ?? {});
|
|
123
|
+
if (parsed === undefined)
|
|
124
|
+
return silent(`the comment is not addressed to ${o.words.product}, or another job answers it`);
|
|
125
|
+
const command = parsed.kind === "refused" ? undefined : parsed.kind;
|
|
126
|
+
const issue = isObject(e.issue) ? e.issue : {};
|
|
127
|
+
const n = issue.number;
|
|
128
|
+
if (typeof n !== "number" || !Number.isInteger(n) || n < 1)
|
|
129
|
+
return silent("the comment has no issue number", command);
|
|
130
|
+
if (!issue.pull_request && issue.is_pull !== true && e.is_pull !== true)
|
|
131
|
+
return silent(`the comment is not on a ${t.request}`, command);
|
|
132
|
+
const user = isObject(comment.user) ? comment.user.login : undefined;
|
|
133
|
+
if (typeof user !== "string" || !LOGIN.test(user))
|
|
134
|
+
return silent("the comment has no usable author", command);
|
|
135
|
+
// Who asked comes first: someone without write access gets no reply and nothing runs.
|
|
136
|
+
if (o.forge === "forgejo") {
|
|
137
|
+
const repository = isObject(e.repository) ? e.repository : {};
|
|
138
|
+
if (repository.full_name !== o.repo)
|
|
139
|
+
return silent("the event is not for this repository", command);
|
|
140
|
+
const sender = isObject(e.sender) ? e.sender.login : undefined;
|
|
141
|
+
if (sender !== user)
|
|
142
|
+
return silent("the comment's author is not the event's sender", command);
|
|
143
|
+
const p = isObject(repository.permissions) ? repository.permissions : {};
|
|
144
|
+
if (p.push !== true && p.admin !== true)
|
|
145
|
+
return silent(`${user} has no write access, so the comment is ignored`, command);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
let permission;
|
|
149
|
+
try {
|
|
150
|
+
permission = await o.reads.permission(user);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
return broke(`could not read ${user}'s permission, so nothing runs (${message(err)})`, command);
|
|
154
|
+
}
|
|
155
|
+
if (permission === undefined || !MAY_ASK.has(permission))
|
|
156
|
+
return silent(`${user} has no write access, so the comment is ignored`, command);
|
|
157
|
+
}
|
|
158
|
+
const reply = async (text, ran = false, url) => {
|
|
159
|
+
const done = { ...(command ? { command } : {}), ran, ...(url ? { url } : {}) };
|
|
160
|
+
try {
|
|
161
|
+
await o.poster.addComment(n, `${o.words.product}: ${text}`);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
return { ...done, replied: false, fail: true, reason: `${text}; and the reply failed (${message(err)})` };
|
|
165
|
+
}
|
|
166
|
+
return { ...done, replied: true, reason: text };
|
|
167
|
+
};
|
|
168
|
+
if (parsed.kind === "refused")
|
|
169
|
+
return reply(parsed.reason);
|
|
170
|
+
// The product plan's re-plan skips these without a word: a target that is none of its own, and a fork with forks: "skip".
|
|
171
|
+
if (parsed.kind === "plan" && o.jobs.preview) {
|
|
172
|
+
// #4979: the product plan's re-plan plans what its verb plans, and takes no flag the grammar reads.
|
|
173
|
+
if (o.jobs.noPlanFlags && (parsed.targets?.length || parsed.refresh || parsed.targetDependents))
|
|
174
|
+
return reply(planFlagsReply(o.words));
|
|
175
|
+
if (parsed.member !== undefined && o.jobs.targets?.length && !o.jobs.targets.includes(parsed.member))
|
|
176
|
+
return reply(memberReply(o.words, parsed.member, o.jobs.targets, o.forge));
|
|
177
|
+
if (o.jobs.skipForks) {
|
|
178
|
+
let pr;
|
|
179
|
+
try {
|
|
180
|
+
pr = await o.reads.pullRequest(n);
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
return broke(`could not read ${t.at(n)} (${message(err)})`, command);
|
|
184
|
+
}
|
|
185
|
+
if (pr && !pr.sameRepo)
|
|
186
|
+
return reply(forkReply(o.words, o.forge));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// A command another job answers starts that job on this same comment.
|
|
190
|
+
if (parsed.kind !== "apply" && answeredElsewhere(parsed, o.jobs, true))
|
|
191
|
+
return silent("another job answers this comment", command);
|
|
192
|
+
switch (parsed.kind) {
|
|
193
|
+
case "plan":
|
|
194
|
+
case "lock":
|
|
195
|
+
case "unlock":
|
|
196
|
+
case "action":
|
|
197
|
+
case "agent":
|
|
198
|
+
return reply(notRunReply(o.words, parsed.kind, o.forge));
|
|
199
|
+
case "commit":
|
|
200
|
+
return silent("the commit job answers this comment", command);
|
|
201
|
+
case "apply":
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
// An apply: the apply before merge answers an open pull request; this job a merged one, with applyOnMerge.
|
|
205
|
+
if (!o.jobs.applyBeforeMerge && !o.jobs.applyOnMerge)
|
|
206
|
+
return reply(notRunReply(o.words, "apply", o.forge));
|
|
207
|
+
let pr;
|
|
208
|
+
try {
|
|
209
|
+
pr = await o.reads.pullRequest(n);
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
return broke(`could not read ${t.at(n)} (${message(err)})`, command);
|
|
213
|
+
}
|
|
214
|
+
if (!pr)
|
|
215
|
+
return broke(`the forge has no ${t.at(n)}`, command);
|
|
216
|
+
const at = t.at(n);
|
|
217
|
+
const verb = o.words.verbs.apply;
|
|
218
|
+
if (pr.state === "open") {
|
|
219
|
+
if (o.jobs.applyBeforeMerge)
|
|
220
|
+
return silent("the apply before merge answers this comment", command);
|
|
221
|
+
return reply(`${at} is not merged: \`/${o.words.product} ${typedApply(o.words)}\` runs the ${verb[0]} of a merged ${t.request} again, from the default branch, and never ${verb[0]}s a ${t.request}'s branch`);
|
|
222
|
+
}
|
|
223
|
+
if (pr.state === "closed")
|
|
224
|
+
return reply(`${at} was closed without merging, so there is nothing of it to ${verb[0]}`);
|
|
225
|
+
if (!o.jobs.applyOnMerge)
|
|
226
|
+
return reply(`${at} is merged, and this ${t.place} ${verb[0]}s a ${t.request} before it merges, so there is nothing of it left to ${verb[0]}`);
|
|
227
|
+
if (!pr.sameRepo)
|
|
228
|
+
return reply(forkReply(o.words, o.forge));
|
|
229
|
+
// #4979: with the waves' op the stop is written for the run; without it a re-run cannot stop.
|
|
230
|
+
const waves = o.stops ? o.jobs.waves : undefined;
|
|
231
|
+
const wave = parsed.wave;
|
|
232
|
+
if (wave !== undefined && !waves) {
|
|
233
|
+
return reply(`a run started again runs the waves after the one that stopped by itself, so \`wave-${wave}\` cannot stop them; write \`/${o.words.product} ${typedApply(o.words)}\`, and each wave still waits behind its own gate`);
|
|
234
|
+
}
|
|
235
|
+
if (wave !== undefined && waves && wave > waves.count)
|
|
236
|
+
return reply(`the ${verb[0]} of this ${t.place} runs in ${waves.count} wave${waves.count === 1 ? "" : "s"}, so there is no \`wave-${wave}\``);
|
|
237
|
+
if (pr.base !== undefined && pr.base !== o.base)
|
|
238
|
+
return reply(`${at} was merged into ${pr.base}, not the default branch ${o.base}, so nothing ${verb[1]} from it`);
|
|
239
|
+
if (!pr.mergeCommit)
|
|
240
|
+
return broke(`${at} has no merge commit`, command);
|
|
241
|
+
const mergeCommit = pr.mergeCommit;
|
|
242
|
+
const start = o.forge === "github" ? githubRerun(o.runs) : forgejoRerun(o.runs, o.reads);
|
|
243
|
+
// The stop goes on chant/lifecycle just before the run starts, so every wave job of the run reads it; an apply without a wave clears it.
|
|
244
|
+
const rerun = waves
|
|
245
|
+
? async (run, jobs, ctx) => {
|
|
246
|
+
try {
|
|
247
|
+
await o.stops(waves.op, mergeCommit, wave !== undefined ? { through: wave, at: (o.now ?? (() => new Date().toISOString()))(), by: user, pr: n } : null);
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
return { kind: "fail", reason: `could not write the wave stop for ${short(mergeCommit)}, so nothing was started (${message(err)})` };
|
|
251
|
+
}
|
|
252
|
+
return start(run, jobs, ctx);
|
|
253
|
+
}
|
|
254
|
+
: start;
|
|
255
|
+
const done = await retryApply({ reads: o.reads, forge: o.poster, words: o.words, base: o.base }, o.forge, pr, user, { kind: "retry", sha: mergeCommit, jobs: RERUN_APPLY_JOBS }, rerun);
|
|
256
|
+
if (done.kind === "fail")
|
|
257
|
+
return broke(done.reason, command);
|
|
258
|
+
const stopped = done.kind === "ran" && wave !== undefined && waves && wave < waves.count ? `; it stops after \`wave-${wave}\`, and the waves after it wait until \`/${o.words.product} ${typedApply(o.words)}\` runs it again` : "";
|
|
259
|
+
return reply(`${done.text}${stopped}`, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
260
|
+
}
|
|
261
|
+
/** The reply to a plan comment with flags the product plan's re-plan cannot take (#4979). */
|
|
262
|
+
export function planFlagsReply(words) {
|
|
263
|
+
const line = Object.entries(words.commands).find(([, c]) => c === "plan")?.[0] ?? "plan";
|
|
264
|
+
const typed = `/${words.product} ${line}`;
|
|
265
|
+
return `\`${typed}\` plans whole ${words.noun[1]} again, every one or the one named after it, so it takes no \`--target\`, \`--refresh\` or \`--target-dependents\`; write \`${typed}\` or \`${typed} <${words.noun[0]}>\``;
|
|
266
|
+
}
|
|
267
|
+
/** The typed apply word. */
|
|
268
|
+
function typedApply(words) {
|
|
269
|
+
return Object.entries(words.commands).find(([, c]) => c === "apply")?.[0] ?? "apply";
|
|
270
|
+
}
|
|
271
|
+
/** Whether every apply job of a run succeeded, and the reply that says the run is still going. */
|
|
272
|
+
function finished(run, jobs, sha, at) {
|
|
273
|
+
if (!run.done)
|
|
274
|
+
return { kind: "reply", text: `workflow run ${run.id} at ${short(sha)} is ${run.status} already, so it is not started again` };
|
|
275
|
+
if (jobs.every((j) => j.conclusion === "success" || j.status === "success"))
|
|
276
|
+
return { kind: "reply", text: `every apply job of ${at}'s merge commit ${short(sha)} already succeeded` };
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
/** GitHub's start: run the run's failed jobs again, and the jobs that need them. */
|
|
280
|
+
export function githubRerun(runs) {
|
|
281
|
+
return async (run, jobs, { sha, at, user }) => {
|
|
282
|
+
const stop = finished(run, jobs, sha, at);
|
|
283
|
+
if (stop)
|
|
284
|
+
return stop;
|
|
285
|
+
try {
|
|
286
|
+
await runs.rerunFailed(run.id);
|
|
287
|
+
}
|
|
288
|
+
catch (e) {
|
|
289
|
+
return { kind: "fail", reason: `could not run the failed jobs of workflow run ${run.id} again (${message(e)})` };
|
|
290
|
+
}
|
|
291
|
+
const link = run.url ? ` (${run.url})` : "";
|
|
292
|
+
return { kind: "ran", text: `started the failed jobs of workflow run ${run.id}${link} at ${at}'s merge commit ${short(sha)} again for ${user}; each wave's gate decides again, and the waves after it follow, each behind its own gate`, ...(run.url ? { url: run.url } : {}) };
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Forgejo's start: Forgejo has no call that runs a run again, so the run's
|
|
297
|
+
* workflow is dispatched on the default branch, which runs its head. That
|
|
298
|
+
* is the merge commit only while no push came after it.
|
|
299
|
+
*/
|
|
300
|
+
export function forgejoRerun(runs, reads) {
|
|
301
|
+
return async (run, jobs, { sha, at, user, base }) => {
|
|
302
|
+
const stop = finished(run, jobs, sha, at);
|
|
303
|
+
if (stop)
|
|
304
|
+
return stop;
|
|
305
|
+
if (!run.workflow)
|
|
306
|
+
return { kind: "fail", reason: `Forgejo did not name the workflow of run ${run.id}, so it cannot be dispatched` };
|
|
307
|
+
let newest;
|
|
308
|
+
try {
|
|
309
|
+
newest = (await reads.branchRuns(base, { event: "push", limit: 1 }))[0];
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
return { kind: "fail", reason: `could not read the newest push on ${base} (${message(e)})` };
|
|
313
|
+
}
|
|
314
|
+
if (newest && newest.headSha !== sha) {
|
|
315
|
+
return { kind: "reply", text: `Forgejo starts a workflow again only at the head of ${base}, which is now ${short(newest.headSha)}, so the merge commit ${short(sha)} of ${at} is not applied again: push to ${base} again` };
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
await runs.dispatch(run.workflow, base);
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
return { kind: "fail", reason: `could not dispatch ${run.workflow} on ${base} (${message(e)})` };
|
|
322
|
+
}
|
|
323
|
+
return { kind: "ran", text: `dispatched ${run.workflow} on ${base} at ${at}'s merge commit ${short(sha)} for ${user}; each wave's gate decides again, and a wave that already applied plans nothing new` };
|
|
324
|
+
};
|
|
325
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The replies to comment commands no job runs (#4946), shared by the GitLab
|
|
3
|
+
* note poll (./ci-note-commands.ts) and the GitHub and Forgejo comment job
|
|
4
|
+
* (./ci-comment-commands.ts), so the two forges answer a command the same
|
|
5
|
+
* way and a product's own sentences (`words.replies`) reach both.
|
|
6
|
+
*
|
|
7
|
+
* A reply names the forge's things in the forge's words: `!12`, a merge
|
|
8
|
+
* request and a project on GitLab; pull request 12 and a repository on
|
|
9
|
+
* GitHub and Forgejo. GitLab's sentences are the ones the note poll wrote
|
|
10
|
+
* before #4946.
|
|
11
|
+
*
|
|
12
|
+
* This module imports nothing at run time.
|
|
13
|
+
*/
|
|
14
|
+
import type { CiProductCommand, CiProductCommentReplies, CiProductWords } from "./ci-product-words.js";
|
|
15
|
+
import type { ForgeKind } from "./pr-forge.js";
|
|
16
|
+
/** How a reply names the forge's things. */
|
|
17
|
+
export interface CommentTerms {
|
|
18
|
+
/** The pull request by number: `!12`, or `pull request 12`. */
|
|
19
|
+
at(n: number): string;
|
|
20
|
+
/** `merge request` or `pull request`. */
|
|
21
|
+
request: string;
|
|
22
|
+
/** `project` or `repository`. */
|
|
23
|
+
place: string;
|
|
24
|
+
}
|
|
25
|
+
/** The terms for `forge`. */
|
|
26
|
+
export declare function commentTerms(forge: ForgeKind): CommentTerms;
|
|
27
|
+
/** `/<product> <word>` in backticks, for the word the words map onto `command`. */
|
|
28
|
+
export declare function commandLine(words: CiProductWords, command: CiProductCommand): string;
|
|
29
|
+
/** The commands no job runs, by the slot a product's reply fills. */
|
|
30
|
+
export type NotRunCommand = Exclude<keyof CiProductCommentReplies, "fork" | "member">;
|
|
31
|
+
/**
|
|
32
|
+
* The reply to a command the pipeline runs no job for: the product's
|
|
33
|
+
* sentence when its words give one, else chant's.
|
|
34
|
+
*/
|
|
35
|
+
export declare function notRunReply(words: CiProductWords, command: NotRunCommand, forge: ForgeKind): string;
|
|
36
|
+
/** The reply to a command on a pull request from a fork. */
|
|
37
|
+
export declare function forkReply(words: CiProductWords, forge: ForgeKind): string;
|
|
38
|
+
/** The reply to a comment that names a member the pipeline was not written with. */
|
|
39
|
+
export declare function memberReply(words: CiProductWords, member: string, members: readonly string[], forge: ForgeKind): string;
|
|
40
|
+
//# sourceMappingURL=ci-comment-replies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-comment-replies.d.ts","sourceRoot":"","sources":["../src/ci-comment-replies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,6BAA6B;AAC7B,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAI3D;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEpF;AAED,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,uBAAuB,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;AAEtF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAiBnG;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAGzE;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAKvH"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The replies to comment commands no job runs (#4946), shared by the GitLab
|
|
3
|
+
* note poll (./ci-note-commands.ts) and the GitHub and Forgejo comment job
|
|
4
|
+
* (./ci-comment-commands.ts), so the two forges answer a command the same
|
|
5
|
+
* way and a product's own sentences (`words.replies`) reach both.
|
|
6
|
+
*
|
|
7
|
+
* A reply names the forge's things in the forge's words: `!12`, a merge
|
|
8
|
+
* request and a project on GitLab; pull request 12 and a repository on
|
|
9
|
+
* GitHub and Forgejo. GitLab's sentences are the ones the note poll wrote
|
|
10
|
+
* before #4946.
|
|
11
|
+
*
|
|
12
|
+
* This module imports nothing at run time.
|
|
13
|
+
*/
|
|
14
|
+
/** The terms for `forge`. */
|
|
15
|
+
export function commentTerms(forge) {
|
|
16
|
+
return forge === "gitlab"
|
|
17
|
+
? { at: (n) => `!${n}`, request: "merge request", place: "project" }
|
|
18
|
+
: { at: (n) => `pull request ${n}`, request: "pull request", place: "repository" };
|
|
19
|
+
}
|
|
20
|
+
/** `/<product> <word>` in backticks, for the word the words map onto `command`. */
|
|
21
|
+
export function commandLine(words, command) {
|
|
22
|
+
return `\`/${words.product} ${Object.entries(words.commands).find(([, c]) => c === command)?.[0] ?? command}\``;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The reply to a command the pipeline runs no job for: the product's
|
|
26
|
+
* sentence when its words give one, else chant's.
|
|
27
|
+
*/
|
|
28
|
+
export function notRunReply(words, command, forge) {
|
|
29
|
+
const own = words.replies?.[command];
|
|
30
|
+
if (own !== undefined)
|
|
31
|
+
return own;
|
|
32
|
+
const t = commentTerms(forge);
|
|
33
|
+
switch (command) {
|
|
34
|
+
case "plan":
|
|
35
|
+
return `this ${t.place} ${words.verbs.plan[0]}s a ${t.request} on each push to it, and no job ${words.verbs.plan[0]}s on a comment`;
|
|
36
|
+
case "apply":
|
|
37
|
+
return `this ${t.place} does not ${words.verbs.apply[0]} on a comment: re-run the ${words.verbs.apply[0]} job on the forge, or push to the default branch again`;
|
|
38
|
+
case "lock":
|
|
39
|
+
case "unlock":
|
|
40
|
+
return `${commandLine(words, command)} does not run here: this ${t.place} takes no locks`;
|
|
41
|
+
case "action":
|
|
42
|
+
return `this ${t.place} has no workflow that runs actions, so ${commandLine(words, "action")} does not run`;
|
|
43
|
+
case "agent":
|
|
44
|
+
return `the agent command is off in this ${t.place}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The reply to a command on a pull request from a fork. */
|
|
48
|
+
export function forkReply(words, forge) {
|
|
49
|
+
const t = commentTerms(forge);
|
|
50
|
+
return words.replies?.fork ?? `a ${t.request} from a fork runs no command: its code never runs with this ${t.place}'s credentials`;
|
|
51
|
+
}
|
|
52
|
+
/** The reply to a comment that names a member the pipeline was not written with. */
|
|
53
|
+
export function memberReply(words, member, members, forge) {
|
|
54
|
+
const listed = [...members].sort().map((m) => `\`${m}\``).join(", ");
|
|
55
|
+
const own = words.replies?.member;
|
|
56
|
+
if (own !== undefined)
|
|
57
|
+
return own.split("{member}").join(member).split("{members}").join(listed);
|
|
58
|
+
return `${member} is not a ${words.noun[0]} of this ${commentTerms(forge).place}. The ${words.noun[1]} are ${listed}.`;
|
|
59
|
+
}
|
package/dist/ci-commit.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const CI_COMMIT_ARG_FLOOR = "0.124.78";
|
|
|
46
46
|
/** The first chant whose `commit land` reads {@link COMMIT_HARNESS_BREAK_ENV} in a BREAK arm of chant's e2e harness (#4836). */
|
|
47
47
|
export declare const CI_COMMIT_HARNESS_BREAK_FLOOR = "0.124.78";
|
|
48
48
|
/** The first chant whose `commit land` replies to a comment refused as it is read, such as a bad argument or a stray word (#4838). */
|
|
49
|
-
export declare const CI_COMMIT_REFUSAL_REPLY_FLOOR = "0.124.
|
|
49
|
+
export declare const CI_COMMIT_REFUSAL_REPLY_FLOOR = "0.124.86";
|
|
50
50
|
/** What starts a commit run: a person's comment, or a check job's finding. */
|
|
51
51
|
export type CommitTrigger = "comment" | "check";
|
|
52
52
|
export declare const COMMIT_TRIGGERS: readonly CommitTrigger[];
|