Lucas Bruckbauer | d6da8ef | 2025-06-24 10:12:23 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Copyright 2025 The Hafnium Authors. |
| 4 | # |
| 5 | # Use of this source code is governed by a BSD-style |
| 6 | # license that can be found in the LICENSE file or at |
| 7 | # https://opensource.org/licenses/BSD-3-Clause. |
| 8 | |
| 9 | set -euo pipefail |
| 10 | |
| 11 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 12 | ROOT_DIR="$(dirname "$SCRIPT_DIR")" |
| 13 | |
| 14 | FROM="${1:-HEAD~1}" |
| 15 | TO="${2:-HEAD}" |
| 16 | |
| 17 | # Install commitlint only if not already available. |
| 18 | if [ ! -d "node_modules/@commitlint/cli" ]; then |
| 19 | export npm_config_cache=/tmp/.npm |
| 20 | npm install -D @commitlint/cli @commitlint/config-conventional |
| 21 | fi |
| 22 | |
| 23 | # Execute the commitlint command. |
| 24 | npx commitlint --from=$FROM --to=$TO --verbose |