Skip to content

Commit

Permalink
Added support for specifying a project or solution to check
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasArdal committed May 14, 2024
1 parent 554403a commit 29003e9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,26 @@ This action will check for vulnerable NuGet packages in the entire repository. I

The code is based on [this excellent blog post by Steven Giesel](https://steven-giesel.com/blogPost/a825c041-26dc-4488-8707-17697871d08e). Development of the action is sponsored by [elmah.io](https://elmah.io).

## Inputs

### `project`

The project or solution file to operate on. If a file is not specified, the command will search current directory for one.

## Example usage

Check all projects and solutions for vulnerable NuGet packages:

```yml
- name: Check vulnerable NuGet packages
uses: elmahio/github-check-vulnerable-nuget-packages-action@v1
uses: elmahio/github-check-vulnerable-nuget-packages-action@v1
```
Check a specific project for vulnerable NuGet packages:
```yml
- name: Check vulnerable NuGet packages
uses: elmahio/github-check-vulnerable-nuget-packages-action@v1
with:
project: 'src/HelloWorld.csproj'
```
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ description: 'GitHub Action to check for vulnerable NuGet packages.'
branding:
icon: 'check-circle'
color: 'green'
inputs:
project:
description: 'The project or solution file to operate on. If a file is not specified, the command will search current directory for one.'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
image: 'Dockerfile'
args:
- ${{ inputs.project }}
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e # This will cause the script to exit on the first error
# Ensure the dotnet command is available in PATH
export PATH="$PATH:/usr/share/dotnet"
OUTPUT=$(dotnet list package --vulnerable)
OUTPUT=$(dotnet list $1 package --vulnerable)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'no vulnerable packages'; then
echo "No vulnerable packages found"
Expand Down

0 comments on commit 29003e9

Please sign in to comment.