Skip to content

Commit

Permalink
Merge pull request #2091 from Hyperkid123/nx-husky
Browse files Browse the repository at this point in the history
Setup git hooks to ensure checks are passing before pushing to repository
  • Loading branch information
Hyperkid123 authored Oct 29, 2024
2 parents de4c985 + 018de11 commit 8e0837d
Show file tree
Hide file tree
Showing 6 changed files with 806 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports ={
extends: ['@commitlint/config-conventional'],
// Ignore rules can be found here
// https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts
defaultIgnores: true,
}
20 changes: 20 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,23 @@ jobs:
- uses: './.github/actions/cache'
- name: Lint
run: npx nx affected -t test:lint --exclude=demo
commitlint:
needs: [install]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: './.github/actions/cache'
- name: install
shell: bash
run: npm i
- name: Validate current commit on push
shell: bash
if: github.event_name == 'push'
run: npx commitlint --last --verbose
- name: Validate PR commits
shell: bash
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
npx --no-install nx affected -t lint --exclude=@redhat-cloud-services/frontend-components-pdf-generator,@redhat-cloud-services/frontend-components-charts
npx --no-install nx affected -t test:unit --exclude=demo
npx --no-install nx affected -t test:component --exclude=demo --parallel=1
npx --no-install nx affected -t build --exclude=demo,@redhat-cloud-services/frontend-components-pdf-generator,@redhat-cloud-services/frontend-components-charts
Loading

0 comments on commit 8e0837d

Please sign in to comment.