Skip to content

Commit 3c66556

Browse files
committed
CI
1 parent 39cb8a0 commit 3c66556

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/tofu.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Tofu
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'README.md'
7+
- 'LICENSE'
8+
- '.gitignore'
9+
branches:
10+
- 'master'
11+
pull_request:
12+
types: [opened, synchronize, reopened, ready_for_review]
13+
paths-ignore:
14+
- 'README.md'
15+
- 'LICENSE'
16+
- '.gitignore'
17+
18+
jobs:
19+
determine-changed-modules:
20+
if: github.event.pull_request.draft == false
21+
runs-on: ubuntu-latest
22+
outputs:
23+
changed_directories: ${{ steps.set-output.outputs.changed_directories }}
24+
steps:
25+
- uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Get changed files
30+
id: changed-files
31+
uses: tj-actions/changed-files@v47
32+
with:
33+
dir_names: true
34+
dir_names_max_depth: 2
35+
dir_names_exclude_current_dir: true
36+
files: "./modules/**"
37+
json: true
38+
quotepath: false
39+
40+
- name: 'Set output in the matrix format'
41+
id: set-output
42+
run: echo "changed_directories={\"dir\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
43+
44+
check:
45+
if: github.event.pull_request.draft == false && ${{ needs.determine-changed-modules.outputs.changed_directories != '' }}
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix: ${{fromJson(needs.determine-changed-modules.outputs.changed_directories)}}
49+
needs:
50+
- determine-changed-modules
51+
steps:
52+
- uses: actions/checkout@v6
53+
- uses: opentofu/setup-opentofu@v1
54+
55+
- name: Check module ${{ matrix.dir }}
56+
working-directory: ${{ matrix.dir }}
57+
run: |
58+
tofu fmt -check
59+
tofu init
60+
tofu validate -no-color
61+

0 commit comments

Comments
 (0)