Skip to content

Commit 9bf0ec3

Browse files
authored
Add coana workflows (#41)
1 parent d0d0a9b commit 9bf0ec3

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/workflows/coana-analysis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Coana Vulnerability Analysis
2+
3+
on:
4+
schedule:
5+
# every day at 12 AM
6+
- cron: '0 0 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
tags:
10+
description: 'Manually run vulnerability analysis'
11+
12+
jobs:
13+
coana-vulnerability-analysis:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 60
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
- name: Run Coana CLI
21+
id: coana-cli
22+
run: |
23+
npx @coana-tech/cli run . \
24+
--api-key ${{ secrets.COANA_API_KEY }} \
25+
--repo-url https://github.com/${{github.repository}}

.github/workflows/coana-guardrail.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Coana Guardrail
2+
3+
on: pull_request
4+
5+
jobs:
6+
guardrail:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 15
9+
steps:
10+
- name: Get changed files
11+
id: changed-files
12+
uses: tj-actions/changed-files@v44
13+
with:
14+
separator: ' '
15+
16+
- name: Checkout the ${{github.base_ref}} branch
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{github.base_ref}} # checkout the base branch (usually master/main).
20+
21+
- name: Use Node.js 20.x
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20.x
25+
26+
- name: Run Coana on the ${{github.base_ref}} branch
27+
run: |
28+
npx @coana-tech/cli run . \
29+
--guardrail-mode \
30+
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
31+
-o /tmp/main-branch \
32+
--changed-files ${{ steps.changed-files.outputs.all_changed_files }} \
33+
--lightweight-reachability \
34+
35+
# Reset file permissions changed by Coana CLI.
36+
- name: Reset file permissions
37+
run: sudo chown -R $USER:$USER .
38+
39+
- name: Checkout the current branch
40+
uses: actions/checkout@v4
41+
with:
42+
clean: true
43+
44+
- name: Run Coana on the current branch
45+
run: |
46+
npx @coana-tech/cli run . \
47+
--guardrail-mode \
48+
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
49+
-o /tmp/current-branch \
50+
--changed-files ${{ steps.changed-files.outputs.all_changed_files }} \
51+
--lightweight-reachability \
52+
53+
- name: Run Report Comparison
54+
run: |
55+
npx @coana-tech/cli compare-reports \
56+
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
57+
/tmp/main-branch/coana-report.json \
58+
/tmp/current-branch/coana-report.json
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)