Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,26 @@ repos:
language: system
pass_filenames: false
files: '(^|/)(MODULE\.bazel|.*\.bzl|BUILD(\.bazel)?)$'

- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
hooks:
- id: actionlint
args:
# Disable shellcheck and pyflakes for now, to enforce consistent behavior.
- -shellcheck=
- -pyflakes=

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
hooks:
name: actionlint
# Disable shellcheck and pyflakes for now, to enforce consistent behavior.
entry: tools/run_tool.sh actionlint -shellcheck= -pyflakes=
language: system
require_serial: true
types: [yaml]
files: ^\.github/workflows/
- id: ruff-check
args: [ --fix ]
name: ruff-check
entry: tools/run_tool.sh ruff check --fix
language: system
require_serial: true
types: [python]
- id: ruff-format
name: ruff-format
entry: tools/run_tool.sh ruff format
language: system
require_serial: true
types: [python]

# Note: this is super slow, therefore it is last
- repo: local
Expand Down
12 changes: 12 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@ docs(
],
source_dir = "docs",
)

# bazel run //:shellcheck
alias(
name = "shellcheck",
actual = "@score_devcontainer//tools:shellcheck",
)

# bazel run //:actionlint
alias(
name = "actionlint",
actual = "@score_devcontainer//tools:actionlint",
)
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ http_file(
)

bazel_dep(name = "score_process", version = "1.5.4")

# Provide the tools from the devcontainer to Bazel
bazel_dep(name = "score_devcontainer", version = "1.5.0")
16 changes: 15 additions & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions tools/run_tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# Unified entry point for running a CLI tool by name.
# Inside a container the tool is expected on PATH; outside, it is resolved via Bazel.
# See https://github.com/eclipse-score/devcontainer/tree/main/tools for further information.

set -euo pipefail

if [[ "$#" -lt 1 ]]; then
echo "Usage: $0 <tool> [args...]" >&2
exit 2
fi

tool_name="$1"
shift

if { [[ -f /.dockerenv ]] || [[ -f /run/.containerenv ]] || [[ -d /devcontainer ]]; } &&
command -v "${tool_name}" >/dev/null 2>&1; then
exec "${tool_name}" "$@"
elif command -v bazel >/dev/null 2>&1; then
exec bazel run "@score_devcontainer//tools:${tool_name}" -- "$@"
else
echo "Could not run '${tool_name}': not available on PATH in a container, and bazel was not found." >&2
exit 127
fi
Loading