Skip to content
Snippets Groups Projects
Unverified Commit 027c620f authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

fix: add update-asdf-version-variables pre-commit script

Tweak curated pre-commit configurations, adding a new configuration for
automatically running scripts/update-asdf-version-variables.sh when
.tool-versions changes.
parent 0a20ef5d
No related branches found
No related tags found
No related merge requests found
Pipeline #21996462 passed
Loading
Loading
@@ -4,34 +4,37 @@
#########################################################
 
- id: golangci-lint
name: golangci-lint (common-ci-tasks)
name: "golangci-lint | common-ci-tasks"
description: Fast linters runner for Go. Note that only modified files are linted, so linters like 'unused' that need to scan all files won't work as expected.
entry: mise exec golangci-lint -- golangci-lint run --new-from-rev HEAD --fix
types: [go]
language: system
require_serial: true
pass_filenames: false
stages: [pre-commit]
 
- id: go-fmt
name: go-fmt (common-ci-tasks)
name: "go-fmt | common-ci-tasks"
entry: scripts/pre-commit/go-fmt.sh
types: [go]
exclude: '(^|/)vendor/'
language: script
description: "Run go-fmt"
pass_filenames: true
stages: [pre-commit]
 
- id: go-imports
name: go-imports (common-ci-tasks)
name: "go-imports | common-ci-tasks"
entry: scripts/pre-commit/go-imports.sh
types: [go]
exclude: '(^|/)vendor/'
language: script
description: "Run go-imports"
pass_filenames: true
stages: [pre-commit]
 
- id: go-mod-tidy
name: go-mod-tidy (common-ci-tasks)
name: "go-mod-tidy | common-ci-tasks"
entry: scripts/pre-commit/go-mod-tidy.sh
types: [go]
exclude: '(^|/)vendor/'
Loading
Loading
@@ -39,20 +42,31 @@
description: "Run go mod tidy"
pass_filenames: true
require_serial: true
stages: [pre-commit]
 
- id: shellcheck
name: shellcheck (common-ci-tasks)
name: "shellcheck | common-ci-tasks"
description: Static analysis tool for shell scripts
language: system
entry: mise exec shellcheck -- shellcheck
args: [--external-sources]
types: [shell]
stages: [pre-commit]
 
- id: shfmt
name: shfmt (common-ci-tasks)
description: Shell source code formatter (prebuilt upstream executable)
name: "shfmt | common-ci-tasks"
description: Shell source code formatter
language: system
entry: mise exec shfmt -- shfmt
args: [-w, -s, -i, "2"]
types: [shell]
exclude_types: [csh, tcsh, zsh]
stages: [pre-commit]
- id: update-asdf-version-variables
name: "update-asdf-version-variables | common-ci-tasks"
description: "Update GitLab CI .gitlab-ci-asdf-versions.yml include to match .tool-versions"
language: script
entry: scripts/pre-commit/update-asdf-version-variables.sh
files: '^(\.gitlab-ci-asdf-versions\.yml|scripts/update-asdf-version-variables.sh|\.tool-versions)$'
stages: [pre-commit]
Loading
Loading
@@ -13,7 +13,7 @@ go mod tidy -v || {
exit 2
}
 
git diff --exit-code go.* &>/dev/null || {
git diff --quiet go.* || {
echo "go.mod or go.sum differs, please re-add it to your commit"
exit 3
}
#!/usr/bin/env bash
#
# Run ./scripts/update-asdf-version-variables.sh
#
set -euo pipefail
IFS=$'\n\t'
eval "$(mise activate bash --shims)"
./scripts/update-asdf-version-variables.sh
git diff --quiet .gitlab-ci-asdf-versions.yml || {
echo ".gitlab-ci-asdf-versions.yml has been updated, please re-add it to your commit"
exit 2
}
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