repowarden 4.3.0-next.5 → 4.3.0-next.6
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/bin/proteger +24 -5
- package/hooks/lib/i18n/en.sh +2 -0
- package/hooks/lib/i18n/fr.sh +2 -0
- package/package.json +1 -1
package/bin/proteger
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# [--sans-tags] [--dry-run]
|
|
15
15
|
# --sans-tags : dépôt qui déplace lui-même un tag (tag majeur flottant v2…).
|
|
16
16
|
# Réglages équivalents dans .repowarden.conf (requiredReviews, codeOwnerReview,
|
|
17
|
-
# unattributedApproval, environment, environmentReviewers). Demande un gh connecté, admin du dépôt.
|
|
17
|
+
# unattributedApproval, deliveryApproval, environment, environmentReviewers). Demande un gh connecté, admin du dépôt.
|
|
18
18
|
set -euo pipefail
|
|
19
19
|
|
|
20
20
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
|
@@ -94,7 +94,8 @@ refs_json() { # branches → "refs/heads/a", "refs/heads/b"
|
|
|
94
94
|
|
|
95
95
|
# Ruleset de branches : $1 nom, $2 branches (liste), $3 méthodes de merge (JSON),
|
|
96
96
|
# $4 PR à jour exigée (défaut true), $5 approbations (défaut REVIEWS),
|
|
97
|
-
# $6 dernier push approuvé par un autre (défaut selon REVIEWS)
|
|
97
|
+
# $6 dernier push approuvé par un autre (défaut selon REVIEWS),
|
|
98
|
+
# $7 règle supplémentaire (JSON), ex. déploiement réussi exigé
|
|
98
99
|
branch_ruleset() {
|
|
99
100
|
# shellcheck disable=SC2086 # liste de branches volontairement découpée
|
|
100
101
|
cat <<JSON
|
|
@@ -118,7 +119,8 @@ branch_ruleset() {
|
|
|
118
119
|
{"type": "required_status_checks", "parameters": {
|
|
119
120
|
"strict_required_status_checks_policy": ${4:-true},
|
|
120
121
|
"do_not_enforce_on_create": false,
|
|
121
|
-
"required_status_checks": [$contexts]}}
|
|
122
|
+
"required_status_checks": [$contexts]}}${7:+,
|
|
123
|
+
$7}
|
|
122
124
|
]
|
|
123
125
|
}
|
|
124
126
|
JSON
|
|
@@ -161,12 +163,25 @@ if [ -n "$integration" ]; then
|
|
|
161
163
|
# le mainteneur peut donc l'approuver), sans exiger un autre approbateur
|
|
162
164
|
# que l'auteur du dernier push sauf si des relectures sont configurées
|
|
163
165
|
livraison=$((REVIEWS > 0 ? REVIEWS : 1))
|
|
166
|
+
# deliveryApproval = deployment (défaut) : la validation humaine est
|
|
167
|
+
# l'approbation de l'environnement de livraison (« Approve and deploy »),
|
|
168
|
+
# exigée par une règle de main (déploiement réussi) ; la revue de PR n'est
|
|
169
|
+
# plus nécessaire (relectures configurées : gardées). review : revue de PR.
|
|
170
|
+
cfg_r deliveryApproval deployment
|
|
171
|
+
DELIVERY="$REPLY"
|
|
172
|
+
[[ "$DELIVERY" =~ ^(deployment|review)$ ]] || { err_t ci.proteger.delivery_invalid; exit 1; }
|
|
173
|
+
deploiement=""
|
|
174
|
+
if [ "$DELIVERY" = deployment ]; then
|
|
175
|
+
ENVIRONMENT="${ENVIRONMENT:-production}"
|
|
176
|
+
livraison="$REVIEWS"
|
|
177
|
+
deploiement="{\"type\": \"required_deployments\", \"parameters\": {\"required_deployment_environments\": [\"$ENVIRONMENT\"]}}"
|
|
178
|
+
fi
|
|
164
179
|
# PR à jour non exigée non plus : le merge commit d'une livraison n'existe
|
|
165
180
|
# que sur main ; strict, la livraison suivante serait bloquée tant que
|
|
166
181
|
# develop ne l'a pas reçu (retour main → develop vide après chaque
|
|
167
182
|
# release). Une livraison n'apporte que develop, vérifiée par la CI ; le
|
|
168
183
|
# retour reste fait quand main a un contenu propre (correctif direct).
|
|
169
|
-
[ -z "$others" ] || rulesets+=("$(branch_ruleset repowarden "$others" '"merge"' false "$livraison" "$last_push")")
|
|
184
|
+
[ -z "$others" ] || rulesets+=("$(branch_ruleset repowarden "$others" '"merge"' false "$livraison" "$last_push" "$deploiement")")
|
|
170
185
|
# Branche d'intégration : PR à jour non exigée. Le retour de main (après
|
|
171
186
|
# une release) serait sinon presque toujours en retard, et « mettre à jour »
|
|
172
187
|
# fusionnerait develop dans main en contournant la livraison ; la CI
|
|
@@ -215,7 +230,11 @@ echo_t ci.proteger.1 "$REPO"
|
|
|
215
230
|
echo_t ci.proteger.2 "$existing"
|
|
216
231
|
echo_t ci.proteger.3 "$CHECKS"
|
|
217
232
|
echo_t ci.proteger.4 "$methods" "$delete_on_merge"
|
|
218
|
-
[ -
|
|
233
|
+
if [ -n "$integration" ] && [ "$DELIVERY" = deployment ]; then
|
|
234
|
+
echo_t ci.proteger.delivery_deploy "$ENVIRONMENT" "$auto_merge"
|
|
235
|
+
elif [ -n "$integration" ]; then
|
|
236
|
+
echo_t ci.proteger.delivery "$livraison" "$auto_merge"
|
|
237
|
+
fi
|
|
219
238
|
echo_t ci.proteger.5 "$tags_msg"
|
|
220
239
|
[ -z "$integration" ] || echo_t ci.proteger.6 "$integration"
|
|
221
240
|
echo_t ci.proteger.7 "$REVIEWS" "$CODEOWNERS" "$UNATTRIBUTED"
|
package/hooks/lib/i18n/en.sh
CHANGED
|
@@ -270,6 +270,8 @@ _msg_en() {
|
|
|
270
270
|
ci.proteger.13) _M="Settings applied." ;;
|
|
271
271
|
ci.proteger.reviews_invalid) _M="--relecteurs: a number from 0 to 9 is expected." ;;
|
|
272
272
|
ci.proteger.codeowners_invalid) _M="codeOwnerReview: true or false." ;;
|
|
273
|
+
ci.proteger.delivery_deploy) _M=" delivery into main: approval of the \"%s\" deployment (Approve and deploy), then merged by the GitHub App; auto-merge of work PRs into develop: %s" ;;
|
|
274
|
+
ci.proteger.delivery_invalid) _M="deliveryApproval: deployment or review." ;;
|
|
273
275
|
ci.proteger.automerge_invalid) _M="autoMergeWork: true or false." ;;
|
|
274
276
|
ci.proteger.unattributed_invalid) _M="unattributedApproval: true or false." ;;
|
|
275
277
|
ci.proteger.no_branch) _M="None of the branches \"%s\" exists on %s." ;;
|
package/hooks/lib/i18n/fr.sh
CHANGED
|
@@ -270,6 +270,8 @@ _msg_fr() {
|
|
|
270
270
|
ci.proteger.13) _M="Réglages appliqués." ;;
|
|
271
271
|
ci.proteger.reviews_invalid) _M="--relecteurs : nombre de 0 à 9 attendu." ;;
|
|
272
272
|
ci.proteger.codeowners_invalid) _M="codeOwnerReview : true ou false." ;;
|
|
273
|
+
ci.proteger.delivery_deploy) _M=" livraison vers main : approbation du déploiement « %s » (Approve and deploy), puis merge par la GitHub App ; merge automatique des PR de travail vers develop : %s" ;;
|
|
274
|
+
ci.proteger.delivery_invalid) _M="deliveryApproval : deployment ou review." ;;
|
|
273
275
|
ci.proteger.automerge_invalid) _M="autoMergeWork : true ou false." ;;
|
|
274
276
|
ci.proteger.unattributed_invalid) _M="unattributedApproval : true ou false." ;;
|
|
275
277
|
ci.proteger.no_branch) _M="Aucune des branches « %s » n'existe sur %s." ;;
|
package/package.json
CHANGED