Skip to content

Commit

Permalink
Add pre-commit tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomdango committed Jun 29, 2023
1 parent 026d0fb commit 2baf5ec
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ name: Release
run-name: Publish Release Version ${{ github.ref_name }}

on:
push:
tags:
- "v*"
push:
tags:
- "v*"

jobs:
get_metadata:
name: Get Metadata
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.determine_prerelease.outputs == 'true' }}
get_metadata:
name: Get Metadata
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.determine_prerelease.outputs == 'true' }}

steps:
- name: Determine if prerelease
id: determine_prerelease
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]*\.[0-9]*\.[0-9]*-.*?\.[0-9]*? ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
publish_release:
name: Publish Release ${{ github.ref_name }}
needs: [get_metadata]
runs-on: ubuntu-latest
steps:
- name: Publish Release
uses: "marvinpinto/[email protected]"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ github.ref_name }}
prerelease: ${{ needs.get_metadata.outputs.prerelease }}
steps:
- name: Determine if prerelease
id: determine_prerelease
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]*\.[0-9]*\.[0-9]*-.*?\.[0-9]*? ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
publish_release:
name: Publish Release ${{ github.ref_name }}
needs: [get_metadata]
runs-on: ubuntu-latest
steps:
- name: Publish Release
uses: "marvinpinto/[email protected]"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ github.ref_name }}
prerelease: ${{ needs.get_metadata.outputs.prerelease }}
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.2
hooks:
- id: editorconfig-checker

- repo: https://github.com/markdownlint/markdownlint
rev: v0.12.0
hooks:
- id: markdownlint_docker

- repo: https://github.com/gitleaks/gitleaks
rev: v8.17.0
hooks:
- id: gitleaks-docker
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ REQUIRED_RUNTIME_DEPENDENCIES = node
install-tflint:
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

install-precommit:
python scripts/pre-commit/pre-commit.pyz install

##############################
## Dependency Check Targets ##
##############################
Expand Down
Binary file added scripts/pre-commit/pre-commit.pyz
Binary file not shown.

0 comments on commit 2baf5ec

Please sign in to comment.