Skip to content

Commit

Permalink
chore: add pre-commit and commitlint workflow checks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellmueller committed Dec 2, 2024
1 parent 9c87aa7 commit 27a31c3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays
workflow_dispatch:

permissions: # used for commitlint
contents: read
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -80,6 +84,31 @@ jobs:
with:
sarif_file: "trivy-results.sarif"

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install eslint packages
run: npm ci
- uses: actions/setup-python@v1
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/action@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}

commitlint: # Test all commits in PR follow conventional commit format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wagoid/commitlint-github-action@v6
with:
configFile: '.commitlintrc.yml'

results:
name: Analysis Results
needs: [tests] # Restore trivy when/if fixed
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ repos:
- id: check-added-large-files

- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v9.15.0" # Use the sha / tag you want to point at
rev: "v9.15.0"
hooks:
- id: eslint
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
files: \.[jt]sx?$
types: [file]

- repo: https://github.com/rbubley/mirrors-prettier
Expand Down

0 comments on commit 27a31c3

Please sign in to comment.