Skip to content

Commit d4936e6

Browse files
authored
fix(ci): Install hadolint in pre-commit workflow (#856)
1 parent 2cf690b commit d4936e6

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.github/workflows/pr_pre-commit.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
env:
88
CARGO_TERM_COLOR: always
99
RUST_TOOLCHAIN_VERSION: "1.80.1"
10+
HADOLINT_VERSION: "v1.17.6"
1011

1112
jobs:
1213
pre-commit:
@@ -22,6 +23,22 @@ jobs:
2223
with:
2324
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
2425
components: rustfmt,clippy
26+
- name: Setup Hadolint
27+
shell: bash
28+
run: |
29+
set -euo pipefail
30+
31+
LOCATION_DIR="$HOME/.local/bin"
32+
LOCATION_BIN="$LOCATION_DIR/hadolint"
33+
34+
SYSTEM=$(uname -s)
35+
ARCH=$(uname -m)
36+
37+
mkdir -p "$LOCATION_DIR"
38+
curl -sL -o "${LOCATION_BIN}" "https://github.com/hadolint/hadolint/releases/download/${{ env.HADOLINT_VERSION }}/hadolint-$SYSTEM-$ARCH"
39+
chmod 700 "${LOCATION_BIN}"
40+
41+
echo "$LOCATION_DIR" >> "$GITHUB_PATH"
2542
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
2643
with:
2744
extra_args: "--from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}"

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
default_language_version:
3+
node: system
4+
25
repos:
36
- repo: https://github.com/pre-commit/pre-commit-hooks
47
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # 4.6.0

0 commit comments

Comments
 (0)