Skip to content

Commit f15b7d5

Browse files
authored
Update dep_review.yaml
1 parent a658210 commit f15b7d5

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/dep_review.yaml

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: 'Dependency Review'
1+
name: Dependency Review
2+
23
on:
34
pull_request:
45
branches:
@@ -7,14 +8,31 @@ on:
78

89
jobs:
910
dependency-review:
11+
runs-on: ubuntu-latest
1012
permissions:
1113
contents: read
1214
pull-requests: write
13-
runs-on: ubuntu-latest
15+
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # this is needed for gh cli
1418
steps:
15-
- name: 'Checkout Repository'
19+
# Checking if repo is public. If it's not, dependency review will be skipped.
20+
- name: Check if repo is public
21+
run: |
22+
response=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" repos/${{ github.repository}} | jq -r '.visibility')
23+
if [ "$response" == "public" ]; then
24+
echo "Repository is Public. Going ahead with dependency Review."
25+
echo 'is_public=true' >> $GITHUB_ENV
26+
fi
27+
28+
# Checkout the repository using actions/checkout
29+
- name: "Checkout Repository"
30+
if: env.is_public == 'true'
1631
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
17-
- name: 'Dependency Review'
32+
33+
# Review dependency changes for any known vulnerabilities using https://github.com/actions/dependency-review-action
34+
- name: "Dependency Review"
35+
if: env.is_public == 'true'
1836
uses: actions/dependency-review-action@2ce029c676cacb6112c47192ee072c7f783330c5
1937
with:
2038
comment-summary-in-pr: always

0 commit comments

Comments
 (0)