Skip to content

Commit b37c7fb

Browse files
committed
CI
1 parent 39cb8a0 commit b37c7fb

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/tofu.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
runs-on: ubuntu-latest
21+
outputs:
22+
changed_directories: ${{ steps.set-output.outputs.changed_directories }}
23+
steps:
24+
- uses: actions/checkout@v6
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Get changed files
29+
id: changed-files
30+
uses: tj-actions/changed-files@v47
31+
with:
32+
dir_names: true
33+
dir_names_max_depth: 2
34+
dir_names_exclude_current_dir: true
35+
files: "./modules/**"
36+
json: true
37+
quotepath: false
38+
39+
- name: 'Set output in the matrix format'
40+
id: set-output
41+
run: echo "changed_directories={\"dir\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
42+
43+
check:
44+
if: github.event.pull_request.draft == false && ${{ needs.determine-changed-modules.outputs.changed_directories != '' }}
45+
strategy:
46+
matrix: ${{fromJson(needs.determine-changed-modules.outputs.changed_directories)}}
47+
needs:
48+
- determine-changed-modules
49+
steps:
50+
- uses: actions/checkout@v6
51+
- uses: opentofu/setup-opentofu@v1
52+
53+
- name: Check module ${{ matrix.dir }}
54+
working-directory: ${{ matrix.dir }}
55+
run: |
56+
tofu fmt -check
57+
tofu init
58+
tofu validate -no-color
59+

0 commit comments

Comments
 (0)