Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more analysis workflow #251

Closed
wants to merge 8 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"
name: "Analysis"

on:
push:
Expand All @@ -27,11 +27,68 @@ on:
schedule:
- cron: '33 23 * * 4'

permissions: write-all
# Declare default permissions as read only.
permissions: read-all

jobs:
analyze:
name: Analyze
analysis:
name: Scorecards
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request' ||
github.head_ref == '${{ github.event.repository.default_branch }}'
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
actions: read
contents: read

steps:
- name: Check out code base
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/checkout@v3
Fixed Show fixed Hide fixed
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
Fixed Show fixed Hide fixed
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Run analysis
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
with:
results_file: results.sarif
results_format: sarif
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}

# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true

- name: Upload artifact
uses: actions/upload-artifact@v3
Fixed Show fixed Hide fixed
with:
name: SARIF file
path: results.sarif

- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
with:
sarif_file: results.sarif

codeql:
name: CodeQL
runs-on: ubuntu-latest

permissions:
Expand Down Expand Up @@ -186,3 +243,37 @@ jobs:
uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # v1.3.1
with:
api-key: ${{ secrets.FOSSA_APIKEY }}

dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Check out code base
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/checkout@v3
Fixed Show fixed Hide fixed
with:
fetch-depth: 0

- name: Check out code base
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
Fixed Show fixed Hide fixed
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Dependency Review
if: github.event_name == 'pull_request'
uses: actions/dependency-review-action@v2
Fixed Show fixed Hide fixed
with:
base-ref: ${{ github.event.repository.default_branch }}
head-ref: ${{ github.event.pull_request.head.sha }}

- name: Dependency Review
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/dependency-review-action@v2
Fixed Show fixed Hide fixed
with:
base-ref: ${{ github.event.repository.default_branch }}
head-ref: ${{ github.sha }}