mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
chore: Add hadolint check for Dockerfiles (#322)
Co-authored-by: Balazs Hamorszky <balihb@gmail.com>
This commit is contained in:
parent
321fb16693
commit
47229003ff
6 changed files with 46 additions and 18 deletions
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
|
|
@ -72,8 +72,8 @@ sudo apt install -y datamash
|
|||
### Run via Docker
|
||||
|
||||
```bash
|
||||
# Build `pre-commit` image
|
||||
docker build -t pre-commit --build-arg INSTALL_ALL=true .
|
||||
# Build `pre-commit-terraform` image
|
||||
docker build -t pre-commit-terraform --build-arg INSTALL_ALL=true .
|
||||
# Build test image
|
||||
docker build -t pre-commit-tests tests/
|
||||
# Run
|
||||
|
|
|
|||
17
.github/workflows/pre-commit.yaml
vendored
17
.github/workflows/pre-commit.yaml
vendored
|
|
@ -25,19 +25,32 @@ jobs:
|
|||
- name: Install shellcheck
|
||||
run: |
|
||||
sudo apt update && sudo apt install shellcheck
|
||||
|
||||
- name: Install hadolint
|
||||
run: |
|
||||
curl -L "$(curl -s https://api.github.com/repos/hadolint/hadolint/releases/latest | grep -o -E -m 1 "https://.+?/hadolint-Linux-x86_64")" > hadolint \
|
||||
&& chmod +x hadolint && sudo mv hadolint /usr/bin/
|
||||
# Need to success pre-commit fix push
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
# Skip terraform_tflint which interferes to commit pre-commit auto-fixes
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Execute pre-commit
|
||||
uses: pre-commit/action@v2.0.0
|
||||
env:
|
||||
SKIP: no-commit-to-branch
|
||||
SKIP: no-commit-to-branch,hadolint
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
extra_args: --color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }}
|
||||
# Run only skipped checks
|
||||
- name: Execute pre-commit check that have no auto-fixes
|
||||
if: always()
|
||||
uses: pre-commit/action@v2.0.0
|
||||
env:
|
||||
SKIP: check-added-large-files,check-merge-conflict,check-vcs-permalinks,forbid-new-submodules,no-commit-to-branch,end-of-file-fixer,trailing-whitespace,check-yaml,check-merge-conflict,check-executables-have-shebangs,check-case-conflict,mixed-line-ending,detect-aws-credentials,detect-private-key,shfmt,shellcheck
|
||||
with:
|
||||
extra_args: --color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue