Skip to content

Commit a521175

Browse files
committed
shellcheck_run_steps: Fix missing filename parameter
Signed-off-by: dann frazier <dann.frazier@chainguard.dev>
1 parent b016305 commit a521175

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

pre_commit_hooks/shellcheck_run_steps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def main(argv: Sequence[str] | None = None) -> int:
119119
"compile",
120120
f"--arch={os.uname().machine}",
121121
"--pipeline-dir=./pipelines",
122+
filename,
122123
],
123124
stdout=compiled_out,
124125
)

scripts/check-for-epoch-bump.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,30 @@ if [ "$#" -lt 1 ]; then
1010
exit 1
1111
fi
1212

13+
epoch_grep() {
14+
grep -E '^[[:space:]]+epoch:'
15+
}
16+
17+
epoch_sed() {
18+
sed -r 's/^[[:space:]]+epoch:[[:space:]]+([0-9])+/\1/'
19+
}
20+
1321
for yaml_file in "$@"; do
1422
echo "Checking $yaml_file:"
1523

1624
# Extract the epoch from the current file using grep and sed
17-
epoch_local=$(grep -E '^[[:space:]]*epoch:' "$yaml_file" | sed 's/.*epoch:[[:space:]]*//')
25+
# (not assuming `yq` is available)
26+
epoch_line="$(epoch_grep < "$yaml_file")"
27+
epoch_local="$(echo "$epoch_line" | epoch_sed)"
1828
if [ -z "$epoch_local" ]; then
1929
echo "Warning: 'epoch' field not found in $yaml_file"
2030
echo ""
2131
continue
2232
fi
2333

2434
# Extract the epoch from the file on the main branch using git show
25-
epoch_main=$(git show main:"$yaml_file" 2>/dev/null | grep -E '^[[:space:]]*epoch:' | sed 's/.*epoch:[[:space:]]*//')
35+
epoch_main_line="$(git show main:"$yaml_file" 2>/dev/null | epoch_grep)"
36+
epoch_main="$(echo "$epoch_main_line" | epoch_sed)"
2637
if [ -z "$epoch_main" ]; then
2738
echo "Warning: 'epoch' field not found in $yaml_file on branch 'main'"
2839
echo ""
@@ -36,4 +47,4 @@ for yaml_file in "$@"; do
3647
echo "⚠️ Epoch HAS NOT been increased compared to main: $epoch_local <= $epoch_main"
3748
fi
3849

39-
done
50+
done

0 commit comments

Comments
 (0)