Skip to content

Commit 83bc40a

Browse files
committed
Add script for running checkton locally
If you don't want to push to a PR just to re-run the linter, you can use this script. Won't work on ARM Macs, sorry! Signed-off-by: Adam Cmiel <acmiel@redhat.com>
1 parent d015294 commit 83bc40a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

hack/checkton-local.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -o errexit -o nounset -o pipefail
3+
4+
get_checkton_image_based_on_action_version() {
5+
sed -nE \
6+
's;^\s*uses: (.*)/checkton.*(v[0-9]\S*);ghcr.io/\1/checkton:\2;p' \
7+
.github/workflows/checkton.yaml
8+
}
9+
10+
mapfile -t checkton_env_vars < <(
11+
env CHECKTON_FIND_COPIES_HARDER="${CHECKTON_FIND_COPIES_HARDER:-true}" | grep '^CHECKTON_'
12+
)
13+
CHECKTON_IMAGE=${CHECKTON_IMAGE:-$(get_checkton_image_based_on_action_version)}
14+
15+
{
16+
echo "Checkton image: $CHECKTON_IMAGE"
17+
18+
echo "CHECKTON_* variables:"
19+
printf " %s\n" "${checkton_env_vars[@]}"
20+
} >&2
21+
22+
23+
if command -v getenforce >/dev/null && [[ "$(getenforce)" == Enforcing ]]; then
24+
z=":z"
25+
else
26+
z=""
27+
fi
28+
29+
mapfile -t env_flags < <(printf -- "--env=%s\n" "${checkton_env_vars[@]}")
30+
31+
podman run --rm --tty -v "$PWD:/code${z}" -w /code "${env_flags[@]}" "$CHECKTON_IMAGE"

0 commit comments

Comments
 (0)