Skip to content

Commit

Permalink
Update Coana Guardrail to not require API key for run (#1214)
Browse files Browse the repository at this point in the history
## Description
Update the Coana Guardrail to no longer require an API key to run. This
allows for forks of public repos such as this one to run successfully.

## Documentation

Does this require changes to the WorkOS Docs? E.g. the [API
Reference](https://workos.com/docs/reference) or code snippets need
updates.

```
[ ] Yes
```

If yes, link a related docs PR and add a docs maintainer as a reviewer.
Their approval is required.
  • Loading branch information
marji-workos authored Jan 27, 2025
1 parent a29db80 commit 4cef66e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/coana-guardrail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,49 @@ jobs:
uses: tj-actions/changed-files@v44
with:
separator: ' '

- name: Checkout the ${{github.base_ref}} branch
uses: actions/checkout@v4
with:
## checkout the base branch (usually master/main).
ref: ${{github.base_ref}}
clean: false
ref: ${{github.base_ref}} # checkout the base branch (usually master/main).

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Run Coana on the ${{github.base_ref}} branch
run: |
npx @coana-tech/cli run . \
--api-key ${{ secrets.COANA_API_KEY }} \
--guardrail-mode \
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
-o /tmp/main-branch \
--changed-files \
${{ steps.changed-files.outputs.all_changed_files }} \
--changed-files ${{ steps.changed-files.outputs.all_changed_files }} \
--lightweight-reachability \
--disable-report-submission \
--repo-url https://github.com/${{github.repository}}
# Reset file permissions changed by Coana CLI.
- name: Reset file permissions
run: sudo chown -R $USER:$USER .

- name: Checkout the current branch
uses: actions/checkout@v4
with:
clean: false
clean: true

- name: Run Coana on the current branch
run: |
npx @coana-tech/cli run . \
--api-key ${{ secrets.COANA_API_KEY }} \
--guardrail-mode \
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
-o /tmp/current-branch \
--changed-files \
${{ steps.changed-files.outputs.all_changed_files }} \
--changed-files ${{ steps.changed-files.outputs.all_changed_files }} \
--lightweight-reachability \
--disable-report-submission \
--repo-url https://github.com/${{github.repository}}
- name: Run Report Comparison
run: |
npx @coana-tech/cli compare-reports \
--api-key ${{ secrets.COANA_API_KEY }} \
--no-block \
--api-key ${{ secrets.COANA_API_KEY || 'api-key-unavailable' }} \
/tmp/main-branch/coana-report.json \
/tmp/current-branch/coana-report.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4cef66e

Please # to comment.