Skip to content

Commit a84f9ea

Browse files
authored
Update GitHub Actions workflows (#384)
* Create scorecard.yml * update runner image from 20.04 to 22.04 * apply recommendations to ci.yaml from OSSF scorecard workflow * apply recommendations to scorecard.yaml from OSSF scorecard workflow
1 parent fc85564 commit a84f9ea

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

Diff for: .github/workflows/ci.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@ name: ci
33

44
on: [pull_request]
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
ci:
8-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-22.04
912
steps:
10-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.4.2
1114
with:
1215
path: guides
1316

14-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.4.2
1518
with:
1619
repository: rubygems/rubygems
1720
path: rubygems
1821
ref: 3.5
1922

2023
- name: Set up Ruby
21-
uses: ruby/setup-ruby@v1
24+
uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc #v1.202.0
2225
with:
2326
ruby-version: 3.2.2
2427
bundler-cache: true

Diff for: .github/workflows/scorecard.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '25 17 * * 4'
14+
push:
15+
branches: [ "main" ]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
30+
steps:
31+
- name: "Checkout code"
32+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
with:
34+
persist-credentials: false
35+
36+
- name: "Run analysis"
37+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
42+
# Public repositories:
43+
# - Publish results to OpenSSF REST API for easy access by consumers
44+
# - Allows the repository to include the Scorecard badge.
45+
# - See https://github.com/ossf/scorecard-action#publishing-results.
46+
publish_results: true
47+
48+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
49+
# format to the repository Actions tab.
50+
- name: "Upload artifact"
51+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
52+
with:
53+
name: SARIF file
54+
path: results.sarif
55+
retention-days: 5
56+
57+
# Upload the results to GitHub's code scanning dashboard (optional).
58+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
59+
- name: "Upload to code-scanning"
60+
uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
61+
with:
62+
sarif_file: results.sarif

0 commit comments

Comments
 (0)