Skip to content

Commit 615c76b

Browse files
committed
ci: Updated workflows to match latest from template.
1 parent ec1ea05 commit 615c76b

File tree

5 files changed

+67
-24
lines changed

5 files changed

+67
-24
lines changed

.github/workflows/branch.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches-ignore:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
lint:
1013
name: Lint updated files
@@ -32,15 +35,15 @@ jobs:
3235
steps:
3336
- name: Checkout source code
3437
uses: actions/checkout@v4
35-
- name: Run Trivy vulnarability scanner
36-
uses: aquasecurity/trivy-action@master
38+
- name: Run Trivy vulnerability scanner
39+
uses: aquasecurity/trivy-action@0.31.0
3740
with:
3841
scan-type: config
3942
format: sarif
40-
output: "trivy-results.sarif"
43+
output: trivy-results.sarif
4144
- name: Parse SARIF file
4245
# Always run this step, even if a previous step failed.
4346
if: always()
4447
uses: Ayrx/[email protected]
4548
with:
46-
sarif_file: "trivy-results.sarif"
49+
sarif_file: trivy-results.sarif

.github/workflows/codeql-analysis.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ on:
1212

1313
jobs:
1414
analyze:
15-
name: Analyze
16-
runs-on: ubuntu-latest
15+
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.
21+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
1722
permissions:
23+
security-events: write
24+
packages: read
1825
actions: read
1926
contents: read
20-
security-events: write
21-
2227
strategy:
2328
fail-fast: false
2429
matrix:
25-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
26-
# Using "javascript" to scan JSON and YAML files.
27-
language: [ 'javascript' ]
28-
30+
include:
31+
# We use javascript to analyze JSON and YAML files.
32+
- language: javascript-typescript
33+
build_mode: none
34+
- language: actions
35+
build_mode: none
2936
steps:
3037
- name: Checkout repository
3138
uses: actions/checkout@v4
32-
33-
# Initializes the CodeQL tools for scanning.
3439
- name: Initialize CodeQL
3540
uses: github/codeql-action/init@v3
3641
with:
3742
languages: ${{ matrix.language }}
38-
# If you wish to specify custom queries, you can do so here or in a config file.
39-
# By default, queries listed here will override any specified in a config file.
40-
# Prefix the list here with "+" to use these queries and those in the config file.
41-
42-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
43-
queries: security-extended,security-and-quality
43+
build-mode: ${{ matrix.build-mode }}
4444
- name: Perform CodeQL Analysis
4545
uses: github/codeql-action/analyze@v3
4646
with:

.github/workflows/main.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
security-events: write
11+
812
jobs:
913
lint:
1014
name: Lint updated modules
1115
runs-on: ubuntu-latest
16+
env:
17+
# Required to avoid rate limiting when downloading plugins.
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1219
steps:
1320
- name: Checkout source code
1421
uses: actions/checkout@v4
@@ -24,7 +31,12 @@ jobs:
2431
- name: Init TFLint
2532
run: tflint --init
2633
- name: Run TFLint
27-
run: tflint --format compact --recursive
34+
run: tflint --format sarif --recursive --config "$GITHUB_WORKSPACE/.tflint.hcl" > tflint-results.sarif
35+
- name: Upload SARIF result
36+
if: always()
37+
uses: github/codeql-action/upload-sarif@v3
38+
with:
39+
sarif_file: tflint-results.sarif
2840

2941
trivy:
3042
name: Run security scan
@@ -33,14 +45,14 @@ jobs:
3345
- name: Checkout source code
3446
uses: actions/checkout@v4
3547
- name: Run Trivy vulnarability scanner
36-
uses: aquasecurity/trivy-action@master
48+
uses: aquasecurity/trivy-action@0.30.0
3749
with:
3850
scan-type: config
3951
format: sarif
40-
output: "trivy-results.sarif"
52+
output: trivy-results.sarif
4153
- name: Upload SARIF result
4254
# Always run this step, even if a previous step failed.
4355
if: always()
4456
uses: github/codeql-action/upload-sarif@v3
4557
with:
46-
sarif_file: "trivy-results.sarif"
58+
sarif_file: trivy-results.sarif

.github/workflows/release.yaml

Lines changed: 8 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,9 +13,14 @@ 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
22+
with:
23+
fetch-depth: 0
1824
- name: Bump version and create changelog
1925
id: bump
2026
uses: commitizen-tools/commitizen-action@master
@@ -38,6 +44,8 @@ jobs:
3844
name: Release module
3945
runs-on: ubuntu-latest
4046
if: startsWith(github.event.head_commit.message, 'bump:')
47+
permissions:
48+
contents: write
4149
steps:
4250
- name: Checkout source code
4351
uses: actions/checkout@v4

.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.40.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)