Skip to content

Commit

Permalink
chore: scaffold project (#1)
Browse files Browse the repository at this point in the history
* chore: scaffold project

* fix: move conventional commit validation to CI workflow

* fix: switch to amannn/action-semantic-pull-request

* fix: rerun conventional commit check when title changed
  • Loading branch information
p5 authored Aug 28, 2024
1 parent 6533f21 commit 8d1a91e
Show file tree
Hide file tree
Showing 12 changed files with 431 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# EditorConfig is awesome: http://EditorConfig.org
# Uses editorconfig to maintain consistent coding styles

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile]
tab_width = 2
indent_style = tab
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src": "1.0.3"
}
13 changes: 13 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
"": {
"changelog-path": "CHANGELOG.md",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"draft": true,
"prerelease": false
}
}
}
33 changes: 33 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices"
],
"packageRules": [
{
// Automatically update minor versions of common GitHub Actions
"automerge": true,
"matchManagers": [
"github-actions"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest",
"pinDigest"
],
"matchDepNames": [
"actions/checkout",
"actions/setup-node",
"actions/setup-go",
"trufflesecurity/trufflehog",
"actions/dependency-review-action",
"advanced-security/set-codeql-language-matrix",
"github/codeql-action/init",
"github/codeql-action/autobuild",
"github/codeql-action/analyze"
]
}
]
}
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
pull_request:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pull-requests: read

jobs:
conventional-commits:
if: ${{ github.event_name }} == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
id: release-please
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/release-please-config.json
manifest-file: .github/.release-please-manifest.json
29 changes: 29 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Renovate

on:
pull_request:
paths:
- ".github/renovate.json"
- ".github/renovate.json5"
- "renovate.json"
- "renovate.json5"

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: latest

# Hosted Renovate should use the latest available version, so always
# install the newest version of Renovate
- name: Install dependencies
run: npm install -g renovate

- name: Validate Renovate config
run: renovate-config-validator --strict
93 changes: 93 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Security

on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 * * 1" # Run every Monday at 00:00 UTC
merge_group:

jobs:
dependency-review:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Dependency Review
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4
with:
fail-on-severity: high

secrets-scan:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@fe5624c70923355128868cffd647b6e2cfe11443 # v3.81.9
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --only-verified

codeql-setup:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.set-matrix.outputs.languages }}
steps:
- name: Get languages from repo
id: set-matrix
uses: advanced-security/set-codeql-language-matrix@975244ea2e4c0668b8d289ac2b61fa7f0976f328 # v1
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
endpoint: ${{ github.event.repository.languages_url }}

codeql-scan:
if: ${{ needs.create-matrix.outputs.matrix != '' }}
needs: codeql-setup
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

# CodeQL uses an older version of Go, so we should set it up ourselves
# so our project can be built with the required version
- name: Setup Go
if: ${{ matrix.language == 'go' }}
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5

- name: Initialize CodeQL
uses: github/codeql-action/init@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3
with:
category: "/language:${{matrix.language}}"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Terraform/Terragrunt
.terraform
.terragrunt-cache
terraform.tfstate
terraform.tfvars
*.tfstate*
Loading

0 comments on commit 8d1a91e

Please sign in to comment.