File tree 1 file changed +22
-4
lines changed
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
- name : ' Dependency Review'
1
+ name : Dependency Review
2
+
2
3
on :
3
4
pull_request :
4
5
branches :
7
8
8
9
jobs :
9
10
dependency-review :
11
+ runs-on : ubuntu-latest
10
12
permissions :
11
13
contents : read
12
14
pull-requests : write
13
- runs-on : ubuntu-latest
15
+
16
+ env :
17
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # this is needed for gh cli
14
18
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'
16
31
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'
18
36
uses : actions/dependency-review-action@2ce029c676cacb6112c47192ee072c7f783330c5
19
37
with :
20
38
comment-summary-in-pr : always
You can’t perform that action at this time.
0 commit comments