Skip to content

Commit

Permalink
chore(husky): improve pre commit checks (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyo committed Jun 17, 2024
1 parent 4a247c6 commit 229e57d
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 111 deletions.
40 changes: 19 additions & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,44 @@
version: 2
updates:
# NPM
-
package-ecosystem: "npm"
- package-ecosystem: 'npm'
directory: /
labels:
- "dependabot"
- "dependencies"
- 'dependabot'
- 'dependencies'
schedule:
interval: "weekly"
interval: 'weekly'
# restrict to patch updates (due to the big amount of dependencies)
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: '*'
update-types:
['version-update:semver-major', 'version-update:semver-minor']
groups:
production-dependencies:
dependency-type: "production"
dependency-type: 'production'
development-dependencies:
dependency-type: "development"
dependency-type: 'development'

# Github Actions
-
package-ecosystem: "github-actions"
- package-ecosystem: 'github-actions'
directory: /
labels:
- "dependabot"
- "github-actions"
- 'dependabot'
- 'github-actions'
schedule:
interval: "weekly"
interval: 'weekly'
groups:
dependencies:
dependency-type: "production"
dependency-type: 'production'

# Docker
-
package-ecosystem: "docker"
- package-ecosystem: 'docker'
directory: ./.conf/
labels:
- "dependabot"
- "docker"
- 'dependabot'
- 'docker'
schedule:
interval: "weekly"
interval: 'weekly'
groups:
dependencies:
dependency-type: "production"
dependency-type: 'production'
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-assets"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-assets'
# variables needed for scripts/legal-notice.sh
SERVER_URL: "${{ github.server_url }}"
REPOSITORY: "${{ github.repository }}"
REF_NAME: "${{ github.ref_name }}"
SERVER_URL: '${{ github.server_url }}'
REPOSITORY: '${{ github.repository }}'
REF_NAME: '${{ github.ref_name }}'

jobs:
build-and-push-image:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/notice-assets.md"
readme-filepath: '.conf/notice-assets.md'

auth-and-dispatch:
needs: build-and-push-image
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
- name: Install Dependencies
run: yarn

- name: Execute linter checks
- name: Prettier checks
run: yarn pretty:check

- name: Linter checks
run: yarn lint

- name: Build Application
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# supported CodeQL languages.
#

name: "CodeQL"
name: 'CodeQL'

on:
push:
Expand All @@ -42,7 +42,7 @@ on:
- 'src/**'
- 'public/**'
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
Expand All @@ -63,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ["javascript"]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
Expand Down Expand Up @@ -104,4 +104,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # v2.227
with:
category: "/language:${{matrix.language}}"
category: '/language:${{matrix.language}}'
4 changes: 1 addition & 3 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ name: Check Dependencies

on:
push:
branches: [ main ]
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
check-dependencies:

runs-on: ubuntu-latest

steps:

- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/kics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
# SPDX-License-Identifier: Apache-2.0
###############################################################

name: "KICS"
name: 'KICS'

on:
push:
branches: [ main ]
branches: [main]
# pull_request:
# The branches below must be a subset of the branches above
# branches: [main, master]
# paths-ignore:
# - "**/*.md"
# - "**/*.txt"
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
Expand All @@ -48,7 +48,7 @@ jobs:
uses: checkmarx/kics-github-action@d1b692d84c536f4e8696954ce7aab6818f95f5bc # v2.0.0
with:
# Scanning directory .
path: "."
path: '.'
# Fail on HIGH severity results
fail_on: high
# when provided with a directory on output_path
Expand All @@ -57,7 +57,7 @@ jobs:
# - results-dir/results.json
# - results-dir/results.sarif
output_path: kicsResults/
output_formats: "json,sarif"
output_formats: 'json,sarif'
# If you want KICS to ignore the results and return exit status code 0 unless a KICS engine error happens
# ignore_on_exit: results
# GITHUB_TOKEN enables this github action to access github API and post comments in a pull request
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pullRequest-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# SPDX-License-Identifier: Apache-2.0
# #############################################################################

name: "Lint PullRequest"
name: 'Lint PullRequest'

on:
pull_request_target:
Expand All @@ -44,11 +44,11 @@ jobs:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/release-release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-assets"
REF_NAME: "${{ github.ref_name }}"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-assets'
REF_NAME: '${{ github.ref_name }}'
# variables needed for scripts/legal-notice.sh
SERVER_URL: "${{ github.server_url }}"
REPOSITORY: "${{ github.repository }}"
SERVER_URL: '${{ github.server_url }}'
REPOSITORY: '${{ github.repository }}'

jobs:
build-and-push-release:
Expand Down Expand Up @@ -88,9 +88,10 @@ jobs:
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
# Automatically prepare image tags;
# semver patter will generate tags like these for example :v1 :v1.2 v1.2.3
images:
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
# Automatically prepare image tags;
# semver patter will generate tags like these for example :v1 :v1.2 v1.2.3
tags: |
type=raw,value=latest
type=raw,value=${{ env.REF_NAME }}
Expand All @@ -116,7 +117,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/notice-assets.md"
readme-filepath: '.conf/notice-assets.md'

auth-and-dispatch:
needs: build-and-push-release
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-assets"
REF_NAME: "${{ github.ref_name }}"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-assets'
REF_NAME: '${{ github.ref_name }}'
# variables needed for scripts/legal-notice.sh
SERVER_URL: "${{ github.server_url }}"
REPOSITORY: "${{ github.repository }}"
SERVER_URL: '${{ github.server_url }}'
REPOSITORY: '${{ github.repository }}'

jobs:
build-and-push-release:
Expand Down Expand Up @@ -89,9 +89,10 @@ jobs:
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
# Automatically prepare image tags;
# semver patter will generate tags like these for example :v1 :v1.2 v1.2.3
images:
${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
# Automatically prepare image tags;
# semver patter will generate tags like these for example :v1 :v1.2 v1.2.3
tags: |
type=raw,value=latest
type=raw,value=${{ env.REF_NAME }}
Expand All @@ -117,7 +118,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/notice-assets.md"
readme-filepath: '.conf/notice-assets.md'

auth-and-dispatch:
needs: build-and-push-release
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-assets"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-assets'
# variables needed for scripts/legal-notice.sh
SERVER_URL: "${{ github.server_url }}"
REPOSITORY: "${{ github.repository }}"
REF_NAME: "${{ github.ref_name }}"
SERVER_URL: '${{ github.server_url }}'
REPOSITORY: '${{ github.repository }}'
REF_NAME: '${{ github.ref_name }}'

jobs:
build-and-push-image:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/notice-assets.md"
readme-filepath: '.conf/notice-assets.md'

auth-and-dispatch:
needs: build-and-push-image
Expand Down
Loading

0 comments on commit 229e57d

Please sign in to comment.