Skip to content

Commit

Permalink
ci: add Scorecard workflow (#3702)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengshunli authored Jul 24, 2024
1 parent 4fdafa4 commit 144ad5f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/sonarcloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Sonarcloud Scan

on:
schedule:
# Weekly on Saturdays.
- cron: '30 1 * * 6'
push:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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

jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-22.04
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Used to receive a badge. (Upcoming feature)
id-token: write
# Needs for private repositories.
contents: read
actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: "Upload artifact"
uses: actions/upload-artifact@v4
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # v2.2.1
with:
sarif_file: results.sarif
8 changes: 8 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sonar.projectKey=gogf_gf
sonar.organization=gogf

sonar.sources=.

sonar.sourceEncoding=UTF-8

sonar.host.url=https://sonarcloud.io

0 comments on commit 144ad5f

Please sign in to comment.