Skip to content

Commit

Permalink
actions: Split lint workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Mar 1, 2024
1 parent 84d1719 commit 32f86f0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 44 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint-caddy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Lint: Caddyfile'

on:
push:
paths:
- '**/Caddyfile'
- .github/workflows/lint-caddy.yml
pull_request:
paths:
- '**/Caddyfile'
- .github/workflows/lint-caddy.yml

jobs:

caddy-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run caddy fmt
run: |
cd caddy
for CADDYFILE in *; do
cp $CADDYFILE Caddyfile.orig
docker run -v "$PWD/$CADDYFILE":/srv/Caddyfile caddy \
caddy fmt --overwrite
diff Caddyfile.orig $CADDYFILE
done
34 changes: 34 additions & 0 deletions .github/workflows/lint-hcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Lint: hcl'

on:
push:
paths:
- '**/{nomad,hcl}'
- .github/workflows/lint-hcl.yml
pull_request:
paths:
- '**/{nomad,hcl}'
- .github/workflows/lint-hcl.yml

jobs:

hcl-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.16.3'

- name: Install hclfmt
run: go install 'github.com/hashicorp/hcl/v2/cmd/hclfmt@latest'

- name: Run hclfmt
run: |
for f in **/*.{nomad,hcl}; do
hclfmt \
-check \
-require-no-change \
-w \
"$f"
done
19 changes: 19 additions & 0 deletions .github/workflows/lint-tf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Lint: tf'

on:
push:
paths:
- '**/*.tf'
- .github/workflows/lint-tf.yml
pull_request:
paths:
- '**/*.tf'
- .github/workflows/lint-tf.yml

jobs:
tf-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format
run: terraform -chdir=terraform fmt -check -diff -recursive
44 changes: 0 additions & 44 deletions .github/workflows/lint.yml

This file was deleted.

0 comments on commit 32f86f0

Please sign in to comment.