Skip to content
Snippets Groups Projects
Unverified Commit d50e7fb0 authored by Florian Forster's avatar Florian Forster
Browse files

fix(yamlfmt): Migrate to `doublestar` path discovery.

See also: gitlab-com/gl-infra/common-ci-tasks-images!454

Issue: gitlab-com/gl-infra/common-template-copier#6
parent 4ee38e08
No related branches found
No related tags found
No related merge requests found
Pipeline #23902452 passed
Loading
Loading
@@ -13,14 +13,22 @@ yamlfmt:
script:
# yamlfmt will fail if this file doesn't exist.
- touch .yamlfmtignore
- |
declare -a PATTERNS=('*.yaml' '*.yml')
if [[ -e .yamlfmtextra ]]; then
IFS=' '
while read -r pattern; do
PATTERNS+=("${pattern}")
done <<<$(grep -E -v '^\s*(#|$)' .yamlfmtextra)
fi
- |
# Dump yamlfmt config
echo "# /etc/yamlfmt.yaml"
cat /etc/yamlfmt.yaml
- yamlfmt -conf /etc/yamlfmt.yaml .
- yamlfmt -conf /etc/yamlfmt.yaml "${PATTERNS[@]}"
- git diff | tee yamlfmt.patch
- |
if [ -s yamlfmt.patch ]; then
if [[ -s yamlfmt.patch ]]; then
red="$(printf "\e[31;1m")"
reset="$(printf "\e[0m")"
echo "${red}Some YAML files are not formatted correctly. Run the following command in the repository root to fix:${reset}"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment