File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
Expand file tree Collapse file tree 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+
23on :
34 pull_request :
45 branches :
78
89jobs :
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
You can’t perform that action at this time.
0 commit comments