Skip to content

Commit

Permalink
chore: improve pre commit hook and prettier checks (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
oyo authored Jun 14, 2024
1 parent c48ad63 commit 74c5c77
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 105 deletions.
40 changes: 19 additions & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,47 @@
version: 2
updates:
# NPM
-
package-ecosystem: "npm"
- package-ecosystem: 'npm'
target-branch: dev
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'
target-branch: dev
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'
target-branch: dev
directory: ./.conf/
labels:
- "dependabot"
- "docker"
- 'dependabot'
- 'docker'
schedule:
interval: "weekly"
interval: 'weekly'
groups:
dependencies:
dependency-type: "production"
dependency-type: 'production'
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-frontend"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-frontend'
# 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 All @@ -54,6 +54,9 @@ jobs:
- name: Install Dependencies
run: yarn

- name: Prettier Checks
run: yarn pretty:check

- name: Linter Checks
run: yarn lint

Expand Down Expand Up @@ -103,7 +106,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/docker-notice-portal.md"
readme-filepath: '.conf/docker-notice-portal.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 @@ -42,7 +42,10 @@ jobs:
- name: Install Dependencies
run: yarn

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

- name: Linter checks
run: yarn lint

- name: Unit Tests
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}}'
2 changes: 0 additions & 2 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ on:

jobs:
check-dependencies:

runs-on: ubuntu-latest

steps:

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

name: "KICS"
name: 'KICS'

on:
push:
Expand All @@ -29,7 +29,7 @@ on:
# - "**/*.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 All @@ -70,4 +70,3 @@ jobs:
uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
with:
sarif_file: kicsResults/results.sarif

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 @@ -28,12 +28,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-frontend"
REF_NAME: "${{ github.ref_name }}"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-frontend'
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 @@ -99,9 +99,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 @@ -127,7 +128,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/docker-notice-portal.md"
readme-filepath: '.conf/docker-notice-portal.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 @@ -29,12 +29,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-frontend"
REF_NAME: "${{ github.ref_name }}"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-frontend'
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 @@ -100,9 +100,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 @@ -128,7 +129,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/docker-notice-portal.md"
readme-filepath: '.conf/docker-notice-portal.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 @@ -28,12 +28,12 @@ on:
workflow_dispatch:

env:
IMAGE_NAMESPACE: "tractusx"
IMAGE_NAME: "portal-frontend"
IMAGE_NAMESPACE: 'tractusx'
IMAGE_NAME: 'portal-frontend'
# 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 @@ -103,7 +103,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
readme-filepath: ".conf/docker-notice-portal.md"
readme-filepath: '.conf/docker-notice-portal.md'

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

0 comments on commit 74c5c77

Please sign in to comment.