ci: устойчивый карантин зависимостей (grep под set -e)
ci / test (push) Successful in 1m48s
ci / lint (push) Successful in 3m50s

grep -v без совпадений возвращает 1; в sh -e это роняло шаг. Добавлен || true.
This commit is contained in:
Maksim Totmin
2026-09-14 00:37:20 +07:00
parent 3018bae23e
commit 39a38bfd74
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -47,7 +47,8 @@ jobs:
run: | run: |
direct=$(go list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all) direct=$(go list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all)
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$' allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$'
bad=$(echo "$direct" | grep -vE "$allowed" | grep -v '^$') bad=$(echo "$direct" | grep -vE "$allowed" | grep -v '^$' || true)
if [ -n "$bad" ]; then if [ -n "$bad" ]; then
echo "недопустимые прямые зависимости:"; echo "$bad"; exit 1 echo "недопустимые прямые зависимости:"; echo "$bad"; exit 1
fi fi
echo "toolkit-deps: ok"
+1 -1
View File
@@ -37,7 +37,7 @@ tidy-check:
toolkit-deps: toolkit-deps:
@direct=$$($(GO) list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all); \ @direct=$$($(GO) list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all); \
allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$$'; \ allowed='^(github.com/modelcontextprotocol/go-sdk|gopkg.in/yaml.v3|github.com/BurntSushi/toml)$$'; \
bad=$$(echo "$$direct" | grep -vE "$$allowed" | grep -v '^$$'); \ bad=$$(echo "$$direct" | grep -vE "$$allowed" | grep -v '^$$' || true); \
if [ -n "$$bad" ]; then \ if [ -n "$$bad" ]; then \
echo "недопустимые прямые зависимости (разрешены только go-sdk/yaml/toml):"; \ echo "недопустимые прямые зависимости (разрешены только go-sdk/yaml/toml):"; \
echo "$$bad"; exit 1; \ echo "$$bad"; exit 1; \