Skip to content

Commit 2bc2279

Browse files
committed
ci: Updated workflows to match latest patterns.
1 parent cb88d97 commit 2bc2279

7 files changed

Lines changed: 116 additions & 98 deletions

File tree

.github/workflows/branch.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ on:
1313
jobs:
1414
analyze:
1515
name: Analyze (${{ matrix.language }})
16-
# Runner size impacts CodeQL analysis time. To learn more, please see:
17-
# - https://gh.io/recommended-hardware-resources-for-running-codeql
18-
# - https://gh.io/supported-runners-and-hardware-resources
19-
# - https://gh.io/using-larger-runners (GitHub.com only)
20-
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2116
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2217
permissions:
2318
security-events: write
@@ -32,7 +27,7 @@ jobs:
3227
build_mode: none
3328
steps:
3429
- name: Checkout repository
35-
uses: actions/checkout@v4
30+
uses: actions/checkout@v6
3631
- name: Initialize CodeQL
3732
uses: github/codeql-action/init@v4
3833
with:

.github/workflows/main.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release New Version
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
@@ -12,6 +13,9 @@ jobs:
1213
name: Build new release
1314
runs-on: ubuntu-latest
1415
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
16+
permissions:
17+
contents: write
18+
pull-requests: write
1519
steps:
1620
- name: Checkout source code
1721
uses: actions/checkout@v4
@@ -40,6 +44,8 @@ jobs:
4044
name: Release module
4145
runs-on: ubuntu-latest
4246
if: startsWith(github.event.head_commit.message, 'bump:')
47+
permissions:
48+
contents: write
4349
steps:
4450
- name: Checkout source code
4551
uses: actions/checkout@v4

.github/workflows/tflint.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: TFLint Checks
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
security-events: write
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
env:
17+
# Required to avoid rate limiting when downloading plugins.
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
steps:
20+
- name: Checkout source code
21+
uses: actions/checkout@v6
22+
- name: Cache plugin directory
23+
uses: actions/cache@v5
24+
with:
25+
path: ~/.tflint.d/plugins
26+
key: tflint-${{ hashFiles('.tflint.hcl') }}
27+
- uses: terraform-linters/setup-tflint@v6
28+
name: Setup TFLint
29+
- name: Show version
30+
run: tflint --version
31+
- name: Init TFLint
32+
run: tflint --init
33+
- name: Run TFLint
34+
# Run TFLint, outputting the results to a SARIF file. We use `tee` so
35+
# that we can still see the output in the logs, and capture the exit
36+
# code properly with `pipefail`.
37+
run: |
38+
set -o pipefail
39+
tflint --format sarif --recursive \
40+
--config "$GITHUB_WORKSPACE/.tflint.hcl" \
41+
| tee tflint-results.sarif
42+
exit "${PIPESTATUS[0]}"
43+
- name: Parse SARIF file for annotations
44+
if: always()
45+
uses: jontyms/sarif-annotations@v0.0.3
46+
with:
47+
annotation-level: notice
48+
sarif-file: tflint-results.sarif
49+
- name: Upload SARIF result
50+
if: always()
51+
uses: github/codeql-action/upload-sarif@v4
52+
with:
53+
sarif_file: tflint-results.sarif

.github/workflows/trivy.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Trivy Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
security-events: write
12+
13+
jobs:
14+
trivy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout source code
18+
uses: actions/checkout@v6
19+
- name: Run Trivy vulnerability scanner
20+
uses: aquasecurity/trivy-action@0.33.1
21+
with:
22+
format: sarif
23+
output: trivy-results.sarif
24+
scan-type: config
25+
trivy-config: trivy.yaml
26+
- name: Parse SARIF file for annotations
27+
if: always()
28+
uses: jontyms/sarif-annotations@v0.0.3
29+
with:
30+
annotation-level: notice
31+
sarif-file: trivy-results.sarif
32+
- name: Upload SARIF result
33+
if: always()
34+
uses: github/codeql-action/upload-sarif@v4
35+
with:
36+
sarif_file: trivy-results.sarif

.tflint.hcl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Uncomment if your module uses the aws provider.
2+
plugin "aws" {
3+
enabled = true
4+
version = "0.38.0"
5+
source = "github.com/terraform-linters/tflint-ruleset-aws"
6+
}
7+
8+
plugin "terraform" {
9+
preset = "all"
10+
enabled = true
11+
}
12+
13+
# TFLint doesn't understand the provider for_each syntax introduced with
14+
# OpenTofu 1.9, so we need to disable these rules so it doesn't error out.
15+
rule "terraform_required_providers" {
16+
enabled = false
17+
}
18+
rule "terraform_unused_required_providers" {
19+
enabled = false
20+
}

0 commit comments

Comments
 (0)