Skip to content

Commit 4a0b208

Browse files
committed
add actions
1 parent 66ae46b commit 4a0b208

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
name: Cortex CLI Code Scan
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
env:
11+
CORTEX_API_KEY: ${{secrets.CORTEX_API_KEY}}
12+
CORTEX_API_KEY_ID: ${{secrets.CORTEX_API_KEY_ID}}
13+
CORTEX_API_URL: https://api-sunglun.xdr.tw.paloaltonetworks.com
14+
15+
jobs:
16+
cortex-code-scan:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout Repository
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
28+
- name: Verify Node.js Version
29+
run: node -v
30+
31+
- name: Download cortexcli
32+
run: |
33+
set -x
34+
crtx_resp=$(curl "${CORTEX_API_URL}/public_api/v1/unified-cli/releases/download-link?os=linux&architecture=amd64" \
35+
-H "x-xdr-auth-id: ${CORTEX_API_KEY_ID}" \
36+
-H "Authorization: ${CORTEX_API_KEY}")
37+
crtx_url=$(echo $crtx_resp | jq -r ".signed_url")
38+
curl -o cortexcli $crtx_url
39+
chmod +x cortexcli
40+
./cortexcli --version
41+
42+
- name: Run Cortex CLI Code Scan
43+
run: |
44+
./cortexcli \
45+
--api-base-url "${CORTEX_API_URL}" \
46+
--api-key "${CORTEX_API_KEY}" \
47+
--api-key-id "${CORTEX_API_KEY_ID}" \
48+
code scan \
49+
--directory "${{github.workspace}}" \
50+
--repo-id "${{github.repository}}" \
51+
--branch "${{github.ref_name}}" \
52+
--source "GITHUB_ACTIONS" \
53+
--create-repo-if-missing

0 commit comments

Comments
 (0)