disable warning react-hooks/exhaustive-deps #831
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: backoffice service ci | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- "backoffice/**" | |
- ".github/workflows/actions/action.yaml" | |
- ".github/workflows/backoffice-ci.yaml" | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- "backoffice/**" | |
- ".github/workflows/actions/action.yaml" | |
- ".github/workflows/backoffice-ci.yaml" | |
workflow_dispatch: | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
env: | |
FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm ci | |
working-directory: backoffice | |
- run: npm run build | |
working-directory: backoffice | |
- run: npm run lint | |
working-directory: backoffice | |
- run: npx prettier --check . | |
working-directory: backoffice | |
- run: npm audit --omit=dev | |
continue-on-error: true | |
working-directory: backoffice | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.24.0 | |
with: | |
scan-type: 'fs' | |
scan-ref: './backoffice' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: SonarCloud Scan | |
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
projectBaseDir: backoffice | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Log in to the Container registry | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker image | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./backoffice | |
tags: ghcr.io/nashtech-garage/yas-backoffice:latest | |
- name: Run Trivy vulnerability scanner | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: aquasecurity/trivy-action@0.24.0 | |
with: | |
image-ref: 'ghcr.io/nashtech-garage/yas-backoffice:latest' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: Push Docker image | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: ./backoffice | |
tags: ghcr.io/nashtech-garage/yas-backoffice:latest | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' |