Skip to content

Fix test workflow to only run on Ubuntu (latest). #839

Fix test workflow to only run on Ubuntu (latest).

Fix test workflow to only run on Ubuntu (latest). #839

name: 'Dependency Review'
on: [pull_request, push, workflow_dispatch]
permissions:
contents: read
pull-requests: write
# https://www.meziantou.net/how-to-cancel-github-workflows-when-pushing-new-commits-on-a-branch.htm
concurrency:
# pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
cancel_others: 'true'
skip_after_successful_duplicate: 'true'
concurrent_skipping: same_content_newer
dependency-review:
needs: pre_job
if: github.actor != 'dependabot[bot]' && needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4.2.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
base-ref: master
head-ref: master
fail-on-severity: high
comment-summary-in-pr: always
- name: Set up .NET
uses: actions/setup-dotnet@v4.3.0
with:
global-json-file: global.json
cache: true
cache-dependency-path: '**/packages.lock.json'
- name: Check for vulnerable packages
run: |
set -e # This will cause the script to exit on the first error
dotnet restore --force-evaluate
OUTPUT=$(dotnet list package --vulnerable --include-transitive)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'Vulnerable'; then
echo "Vulnerable packages found"
exit 1
else
echo "No vulnerable packages found"
fi