repowarden 4.4.0-next.7 → 4.7.0
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/README.md +45 -16
- package/bin/commit +2 -2
- package/bin/pr-checks +35 -0
- package/bin/pr-label +51 -0
- package/bin/proteger +87 -9
- package/bin/repowarden +13 -1
- package/bin/run-list +58 -0
- package/bin/run-rerun +65 -0
- package/bin/statut +1 -0
- package/bin/ticket +5 -0
- package/bin/ticket-comment +32 -0
- package/bin/ticket-label +52 -0
- package/bin/tickets +14 -1
- package/ci/tickets/issue.sh +19 -4
- package/ci/tickets/pr.sh +23 -7
- package/ci/tickets/push.sh +95 -13
- package/ci/tickets/registre.sh +19 -0
- package/ci/tickets/release.sh +1 -0
- package/hooks/lib/i18n/en.sh +41 -0
- package/hooks/lib/i18n/fr.sh +41 -0
- package/hooks/lib/tickets.sh +71 -4
- package/hooks/pre-push +89 -2
- package/package.json +4 -4
package/hooks/pre-push
CHANGED
|
@@ -46,8 +46,6 @@ if ! skipped protect-branch; then
|
|
|
46
46
|
done <<<"$REFS"
|
|
47
47
|
fi
|
|
48
48
|
|
|
49
|
-
skipped tests && { info "Tests désactivés (repowarden.skip)."; exit 0; }
|
|
50
|
-
|
|
51
49
|
REMOTE="${1:-origin}"
|
|
52
50
|
|
|
53
51
|
# Fichiers modifiés par le push de <sha> : depuis l'état distant connu, ou pour
|
|
@@ -68,6 +66,95 @@ changed_files() {
|
|
|
68
66
|
fi
|
|
69
67
|
}
|
|
70
68
|
|
|
69
|
+
# Linting des fichiers modifiés (shellcheck, actionlint, etc.) : ce que la CI
|
|
70
|
+
# refusera doit être vu avant le push. Désactivable avec repowarden.skip lint.
|
|
71
|
+
if ! skipped lint; then
|
|
72
|
+
# Sévérité shellcheck : warning (défaut), error, style. Config : repowarden.lintSeverity.
|
|
73
|
+
cfg_r lintSeverity warning
|
|
74
|
+
LINT_SEVERITY="$REPLY"
|
|
75
|
+
|
|
76
|
+
# Commande d'installation suggérée selon l'OS
|
|
77
|
+
lint_install_cmd() {
|
|
78
|
+
case "$1" in
|
|
79
|
+
shellcheck)
|
|
80
|
+
case "${OSTYPE:-}" in
|
|
81
|
+
darwin*) printf 'brew install shellcheck' ;;
|
|
82
|
+
linux*) printf 'apt-get install shellcheck' ;;
|
|
83
|
+
msys*|cygwin*|win*) printf 'choco install shellcheck' ;;
|
|
84
|
+
*) printf 'https://www.shellcheck.net/' ;;
|
|
85
|
+
esac
|
|
86
|
+
;;
|
|
87
|
+
actionlint)
|
|
88
|
+
case "${OSTYPE:-}" in
|
|
89
|
+
darwin*) printf 'brew install actionlint' ;;
|
|
90
|
+
linux*) printf 'go install github.com/rhysd/actionlint/cmd/actionlint@latest' ;;
|
|
91
|
+
msys*|cygwin*|win*) printf 'scoop install actionlint' ;;
|
|
92
|
+
*) printf 'https://github.com/rhysd/actionlint' ;;
|
|
93
|
+
esac
|
|
94
|
+
;;
|
|
95
|
+
*) printf '%s' "$1" ;;
|
|
96
|
+
esac
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# Vrai si le fichier $1 est un script shell (extension .sh/.bash ou shebang)
|
|
100
|
+
is_shell_script() {
|
|
101
|
+
local file="$1" first_line
|
|
102
|
+
case "$file" in
|
|
103
|
+
*.sh|*.bash) return 0 ;;
|
|
104
|
+
esac
|
|
105
|
+
# Pas d'extension reconnue : on lit la 1re ligne (shebang)
|
|
106
|
+
IFS= read -r first_line <"$file" 2>/dev/null || return 1
|
|
107
|
+
case "$first_line" in
|
|
108
|
+
'#!/bin/sh'|'#!/bin/bash'|'#!/usr/bin/env sh'|'#!/usr/bin/env bash'|'#!/usr/bin/env -S bash'*)
|
|
109
|
+
return 0 ;;
|
|
110
|
+
esac
|
|
111
|
+
return 1
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
lint_changed_files() {
|
|
115
|
+
local changed_file rc=0
|
|
116
|
+
# Les checks optionnels (style, info) ne sont activés que si la sévérité le demande
|
|
117
|
+
local shellcheck_opts="--severity=$LINT_SEVERITY"
|
|
118
|
+
case "$LINT_SEVERITY" in
|
|
119
|
+
style|info) shellcheck_opts="$shellcheck_opts -o all" ;;
|
|
120
|
+
esac
|
|
121
|
+
while IFS= read -r changed_file; do
|
|
122
|
+
[ -f "$changed_file" ] || continue
|
|
123
|
+
if is_shell_script "$changed_file"; then
|
|
124
|
+
if has shellcheck; then
|
|
125
|
+
step_t hook.pre_push.lint.run "shellcheck" "$changed_file"
|
|
126
|
+
# shellcheck disable=SC2086
|
|
127
|
+
shellcheck $shellcheck_opts "$changed_file" || rc=1
|
|
128
|
+
else
|
|
129
|
+
local install_cmd; install_cmd="$(lint_install_cmd shellcheck)"
|
|
130
|
+
warn_t hook.pre_push.lint.missing "shellcheck" "$changed_file" "$install_cmd"
|
|
131
|
+
[ -n "${REPOWARDEN_WARN_FILE:-}" ] && return 1
|
|
132
|
+
fi
|
|
133
|
+
elif case "$changed_file" in .github/workflows/*.yml|.github/workflows/*.yaml) true;; *) false;; esac; then
|
|
134
|
+
if has actionlint; then
|
|
135
|
+
step_t hook.pre_push.lint.run "actionlint" "$changed_file"
|
|
136
|
+
actionlint "$changed_file" || rc=1
|
|
137
|
+
else
|
|
138
|
+
local install_cmd; install_cmd="$(lint_install_cmd actionlint)"
|
|
139
|
+
warn_t hook.pre_push.lint.missing "actionlint" "$changed_file" "$install_cmd"
|
|
140
|
+
[ -n "${REPOWARDEN_WARN_FILE:-}" ] && return 1
|
|
141
|
+
fi
|
|
142
|
+
fi
|
|
143
|
+
done
|
|
144
|
+
return "$rc"
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
LINT_FAILED=0
|
|
148
|
+
while read -r _ local_sha _ remote_sha; do
|
|
149
|
+
# suppression de branche : rien à lint
|
|
150
|
+
if [ -z "$local_sha" ] || [[ "$local_sha" =~ ^0+$ ]]; then continue; fi
|
|
151
|
+
changed_files "$local_sha" "$remote_sha" | lint_changed_files || LINT_FAILED=1
|
|
152
|
+
done <<<"$REFS"
|
|
153
|
+
[ "$LINT_FAILED" -eq 0 ] || exit 1
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
skipped tests && { info "Tests désactivés (repowarden.skip)."; exit 0; }
|
|
157
|
+
|
|
71
158
|
run_tests_for() { test_projects <"$1"; }
|
|
72
159
|
|
|
73
160
|
TESTED=""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repowarden",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "Hooks git et CI multi-langages : messages de commit, nommage des branches, secrets, formatage, tests ciblés, code mort, releases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git-hooks",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"ci",
|
|
11
11
|
"release"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://
|
|
14
|
-
"bugs": "https://github.com/
|
|
13
|
+
"homepage": "https://simdevwarden.github.io/repowarden/",
|
|
14
|
+
"bugs": "https://github.com/simdevWarden/repowarden/issues",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/simdevWarden/repowarden.git"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "SimBienvenueHoulBoumi (https://github.com/SimBienvenueHoulBoumi)",
|