Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example when using file to upload SARIF #34

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ improvement campaign_ analysis.
> fixes to the default branch immediately, add a comment with the contents
> "@pixeebot next" to any PR or issue in the repository.

## For Other Tools

For other supported tools that do not automatically fetch results, the `file`
input can be used. In this case, it is assumed that the results file is checked
into the repository and the provided path is relative to the repository root.

```yaml
- uses: pixee/upload-tool-results-action@v2
with:
# Use any supported SARIF tool here
drdavella marked this conversation as resolved.
Show resolved Hide resolved
tool: <[semgrep|checkmarx|...]>
# Path to the checked-in SARIF file relative to the repository root
file: <path/to/results.sarif>
```

For a complete example, see [sarif-pixeebot.yml](./examples/sarif-pixeebot.yml).

## Permissions

All workflows using this action must include the `id-token: write` permission.
Expand Down
23 changes: 23 additions & 0 deletions examples/sarif-pixeebot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Publish SARIF File to Pixee"
on:
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
share:
name: Upload Sonar Results to Pixeebot
runs-on: ubuntu-latest
steps:
# Assuming the file is checked into the repository, we need to check out the code
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: pixee/upload-tool-results-action@v2
with:
# Use any supported SARIF tool here
drdavella marked this conversation as resolved.
Show resolved Hide resolved
tool: <[semgrep|checkmarx|...]>
# Path to the checked-in SARIF file relative to the repository root
file: <path/to/sarif.json>