Skip to content

Commit

Permalink
format.sh: lint github ci configuration
Browse files Browse the repository at this point in the history
Update `format.sh` to run the `actionlint` tool to check for errors in
GitHub CI configuration. Both this script and the workflow to run this
tool in CI run it using docker to ensure that the same version is in
use in both places.

Signed-off-by: Russell Bryant <[email protected]>
  • Loading branch information
russellb committed Aug 27, 2024
1 parent 0956a41 commit 5c5d1a3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,31 @@ else
fi
echo 'vLLM clang-format: Done'

echo 'vLLM actionlint:'

DOCKER=""
DOCKER_RUN_OPTS=""
if command -v "docker" &>/dev/null; then
DOCKER="docker"
elif command -v "podman" &>/dev/null; then
DOCKER="podman"
DOCKER_RUN_OPTS="--userns=keep-id"
else
echo "Docker or Podman are not installed. Please install one if you want to lint GitHub CI configuration."
fi

actionlint() {
if [ -z "$DOCKER" ]; then
return
fi
# Ensure we use the same version of actionlint as CI
IMAGE="vllm/actionlint:latest"
${DOCKER} build --tag "${IMAGE}" - < .github/workflows/actionlint.dockerfile
${DOCKER} run --volume="${PWD}:/repo:z" --workdir=/repo "${IMAGE}" -color
}

actionlint
echo 'vLLM actionlint: Done'

if ! git diff --quiet &>/dev/null; then
echo 'Reformatted files. Please review and stage the changes.'
Expand Down

0 comments on commit 5c5d1a3

Please sign in to comment.