Skip to content

Commit

Permalink
Workflow tuning (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
withinfocus authored Jun 11, 2024
1 parent 2e91f1e commit 8c959a0
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 17 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
---
name: Build

on:
push:
paths-ignore:
- ".github/workflows/**"
workflow_dispatch:
inputs: {}

defaults:
run:
shell: bash

jobs:
lint:
name: Build
runs-on: ubuntu-22.04

steps:
- name: Checkout repo
- name: Check out repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: "npm"
cache-dependency-path: "**/package-lock.json"
node-version: "18"

- name: Build
run: |
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
---
name: Lint

on:
push:
paths-ignore:
- ".github/workflows/**"
workflow_dispatch:
inputs: {}

defaults:
run:
shell: bash

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04

steps:
- name: Checkout repo
- name: Check out repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
cache: "npm"
cache-dependency-path: "**/package-lock.json"
node-version: "18"

- name: Run linter and spellcheck
- name: Lint and spellcheck
run: |
npm ci
npm run lint
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Scan

on:
workflow_dispatch:
push:
branches:
- "main"
pull_request_target:
types: [opened, synchronize]

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

sast:
name: SAST scan
runs-on: ubuntu-22.04
needs: check-run
permissions:
contents: read
pull-requests: write
security-events: write

steps:
- name: Check out repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Scan with Checkmarx
uses: checkmarx/ast-github-action@831a8d51a8a0535c0399f9c12728d8d3cc22d850 # 2.0.28
env:
INCREMENTAL:
"${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
with:
project_name: ${{ github.repository }}
cx_tenant: ${{ secrets.CHECKMARX_TENANT }}
base_uri: https://ast.checkmarx.net/
cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }}
cx_client_secret: ${{ secrets.CHECKMARX_SECRET }}
additional_params: |
--report-format sarif \
--filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
--output-path . ${{ env.INCREMENTAL }}
- name: Upload Checkmarx results to GitHub
uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
with:
sarif_file: cx_result.sarif

quality:
name: Quality scan
runs-on: ubuntu-22.04
needs: check-run
permissions:
contents: read
pull-requests: write

steps:
- name: Check out repo
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Scan with SonarCloud
uses: sonarsource/sonarcloud-github-action@4006f663ecaf1f8093e8e4abb9227f6041f52216 # v2.2.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: >
-Dsonar.organization=${{ github.repository_owner }} -Dsonar.projectKey=${{
github.repository_owner }}_${{ github.event.repository.name }}

0 comments on commit 8c959a0

Please sign in to comment.