Skip to content

Commit

Permalink
feat(gh): introduce reusable workflows (#7)
Browse files Browse the repository at this point in the history
<!-- Provide a general summary of your changes in the Title above -->

## Description
<!-- Describe your changes in detail -->

## Motivation and Context
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->

## How has this been tested?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, tests ran to see how
-->
<!-- your change affects other areas of the code, etc. -->

## Are there any related PR?
<!-- Please mention related PRs here. -->
<!-- Include PR queue priority here. -->

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix / Chore (PATCH) (non-breaking change which fixes an issue
or does not add functionality)
- [ ] New feature (MINOR) (non-breaking change which adds functionality)
- [ ] Breaking change (MAJOR) (fix or feature that would cause existing
functionality to not work as expected)
  • Loading branch information
aamkye authored Dec 13, 2024
1 parent 970185d commit 9f41676
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 179 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/bumper.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/label.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/pre_commit.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/reusable_assign_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Reusable"

on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- labeled
- unlabeled
- opened
- reopened
- synchronize

jobs:
assign:
name: "Assign"
uses: Inetum-Poland/.github/.github/workflows/assign_label.yml@main
24 changes: 24 additions & 0 deletions .github/workflows/reusable_assign_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Reusable"

on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- labeled
- unlabeled
- opened
- reopened
- synchronize

jobs:
assign:
name: "Assign"
uses: Inetum-Poland/.github/.github/workflows/assign_tag.yml@main
with:
bump_fail_if_no_level: true
bump_latest: true
bump_semver: true
15 changes: 15 additions & 0 deletions .github/workflows/reusable_verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Reusable"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
verify:
name: "Verify"
uses: Inetum-Poland/.github/.github/workflows/verify.yml@main
secrets: inherit
15 changes: 15 additions & 0 deletions .github/workflows/reusable_verify_semantic_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Reusable"

on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited

jobs:
verify:
name: "Verify"
uses: Inetum-Poland/.github/.github/workflows/verify_semantic_pr.yml@main
secrets: inherit
23 changes: 0 additions & 23 deletions .github/workflows/semantic_pr.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/trufflehog.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ pre-commit = 'latest'
python = '3.12'
terraform = "1.8"
terraform-docs = 'latest'
trivy = 'latest'
trufflehog = 'latest'

[plugins]
trufflehog = 'https://github.com/Inetum-Poland/asdf-trufflehog.git'

[settings]
legacy_version_file_disable_tools = ['terraform']
not_found_auto_install = true

[alias]
python = 'asdf:asdf-community/asdf-python'
74 changes: 33 additions & 41 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,71 @@
---
# https://github.com/antonbabenko/pre-commit-terraform
# brew install pre-commit terraform-docs tflint tfsec trivy checkov terrascan infracost tfupdate minamijoyo/hcledit/hcledit jq

# https://github.com/pre-commit/pre-commit-hooks
# https://github.com/python-jsonschema/check-jsonschema/

# https://github.com/trufflesecurity/trufflehog
fail_fast: true

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.1.0
rev: v3.6.0
hooks:
- id: conventional-pre-commit
name: Check Conventional Commit
stages: [commit-msg]
args: [--strict, --force-scope]

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.2
hooks:
- id: terraform_fmt
name: Check Terraform FMT
stages: [pre-commit]
- id: terraform_trivy
name: Check Terraform Trivy
stages: [pre-commit]
- id: terraform_validate
name: Check Terraform Validate
stages: [pre-commit]
- id: terraform_docs
name: Check Terraform Docs
stages: [pre-commit]
args:
- --args=--config=.tfdocs-config.yml
# - id: tfupdate

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-yaml
name: Check YAML
stages: [pre-commit]
# - id: check-json
# name: Check JSON

- id: mixed-line-ending
name: Check Mixed Line Endings
stages: [pre-commit]
args: [--fix=lf]

- id: end-of-file-fixer
name: Check End of Files
stages: [pre-commit]

- id: trailing-whitespace
name: Check Trailing Whitespace
stages: [pre-commit]
args: [
--markdown-linebreak-ext=.md
]
args: [--markdown-linebreak-ext=md]

- id: check-merge-conflict
name: Check for Merge Conflicts
stages: [pre-commit]

- id: detect-private-key
name: Check Private Keys
stages: [pre-commit]

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.96.2
hooks:
- id: terraform_validate
name: Check Terraform Validate
stages: [manual]

- id: terraform_fmt
name: Check Terraform FMT
stages: [pre-commit]
args:
- --hook-config=--parallelism-limit=1

- id: terraform_docs
name: Check Terraform Docs
stages: [pre-commit]
args:
- --args=--config=.tfdocs-config.yml

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
rev: 0.29.4
hooks:
# - id: check-github-actions
# name: Check GitHub Actions
# args: ["--verbose"]
- id: check-github-workflows
name: Check GitHub Workflows
stages: [pre-commit]
args: ["--verbose"]

- repo: local
hooks:
- id: trufflehog
name: Check TruffleHog
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail --no-update'
language: system
stages: ["pre-commit", "push"]

0 comments on commit 9f41676

Please sign in to comment.