Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 81d775e

Browse files
new workflow added
1 parent 9ace01b commit 81d775e

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

.github/workflows/cxflow.yml

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,17 @@
11
name: CxFlow-GitHub-Pull-Request
2-
# Controls when the action will run. Triggers the workflow on push or pull request events but only for the master branch
32
on:
43
pull_request:
54
types: [ready_for_review]
6-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel - this job is specifically configured to use the Checkmarx CxFlow Action
75
jobs:
8-
# This workflow contains a single job called "build"
96
build:
10-
# The type of runner that the job will run on - Ubuntu is required as Docker is leveraged for the action
117
runs-on: self-runner-node
128
steps:
13-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
14-
- uses: actions/checkout@v2
15-
- name: Checkmarx CxFlow Action
16-
id: checkmarx
17-
uses: checkmarx-ts/checkmarx-cxflow-github-action@v1.4
18-
with:
19-
project: ${{ github.repository }}-PR
20-
team: ${{ secrets.CHECKMARX_TEAMS }}
21-
checkmarx_url: ${{ secrets.CHECKMARX_URL }} # To be stored in GitHub Secrets.
22-
checkmarx_username: ${{ secrets.CHECKMARX_USERNAME }} # To be stored in GitHub Secrets.
23-
checkmarx_password: ${{ secrets.CHECKMARX_PASSWORD }} # To be stored in GitHub Secrets.
24-
checkmarx_client_secret: ${{ secrets.CHECKMARX_CLIENT_SECRET }} # To be stored in GitHub Secrets.
25-
scan-preset: Checkmarx Default
26-
incremental: true
27-
break_build: false
28-
scanners: sast
29-
params: --namespace=${{ github.repository_owner }} --cx-flow.filterStatus=New --repo-name=${{ github.event.repository.name }} --branch=${{ github.head_ref }} --cx-flow.filterSeverity --cx-flow.filterCategory --cx-flow.zip-exclude="\.git\/.*,\.github\/.*,tests\/.*,__tests__\/.*,__mocks__\/.*,\.*\/.*,test\/.*,doc\/.*,_unit\/.*"
30-
- name: The job has failed
31-
if: ${{ failure() }}
9+
- name: Trigger to Scanner Lambda
3210
run: |
3311
python -c '
3412
import json,sys,requests;
35-
github_result = {"repository": "'${{ github.repository }}'", "server_url": "'${{ github.server_url }}'", "run_id": "'${{ github.run_id }}'"};
36-
request = {"checkmarx_result": "empty", "github": github_result};
37-
requests.post("'$LambdaWebHook'", json=request);'
38-
env:
39-
LambdaWebHook: ${{ secrets.CHECKMARX_LAMBDA_WEBHOOK }}
40-
- name: Checkmarx Response Send to Lambda
41-
id: slack-notification
42-
if: ${{ success() }}
43-
run: |
44-
python -c '
45-
import json,sys,requests;
46-
output=open("./cx.sarif");
47-
json_result=json.loads(output.read());
48-
response="";
49-
json_result = json_result.get("runs", [{}])[0].get("tool", {}).get("driver", {}).get("rules", []);
50-
github_result = {"repository": "'${{ github.repository }}'", "server_url": "'${{ github.server_url }}'", "run_id": "'${{ github.run_id }}'"};
51-
request = {"checkmarx_result": json_result, "github": github_result};
52-
requests.post("'$LambdaWebHook'", json=request);'
13+
github = {"repository": "'${{ github.event.repository.name }}'", "ref": "'${{ github.head_ref }}'"};
14+
github_request = {"checkmarx_gitaction": github};
15+
requests.post("'$LambdaWebHook'", json=github_request);'
5316
env:
5417
LambdaWebHook: ${{ secrets.CHECKMARX_LAMBDA_WEBHOOK }}

0 commit comments

Comments
 (0)