Skip to content

Commit 17d9032

Browse files
Improve code score card (#1999)
1 parent acb7289 commit 17d9032

File tree

5 files changed

+98
-15
lines changed

5 files changed

+98
-15
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
8+
- package-ecosystem: npm
9+
directory: /
10+
schedule:
11+
interval: weekly

.github/workflows/Build and test.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,88 @@ permissions: read-all
1010

1111
jobs:
1212
Build:
13+
permissions:
14+
contents: write
1315
runs-on: blacksmith-4vcpu-ubuntu-2204
1416
steps:
15-
- uses: actions/checkout@v4
16-
- name: Bulid from src
17-
uses: useblacksmith/setup-node@v5
17+
- name: Harden Runner
18+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
19+
with:
20+
egress-policy: audit
21+
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
24+
- name: Build from src
25+
uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
1826
with:
1927
node-version: '20.x'
28+
2029
- run: yarn install --frozen-lockfile
2130
- run: yarn build-only
22-
- uses: actions/upload-artifact@master
31+
32+
- uses: actions/upload-artifact@v3
2333
with:
2434
name: dist
2535
path: dist/
36+
2637
- run: tar -cvf node_modules.tar node_modules
27-
- uses: actions/upload-artifact@master
38+
39+
- uses: actions/upload-artifact@v3
2840
with:
2941
name: node_modules
3042
path: node_modules.tar
3143

3244
test_node:
45+
permissions:
46+
contents: read
3347
needs: Build
3448
runs-on: blacksmith-4vcpu-ubuntu-2204
3549
strategy:
3650
matrix:
3751
node-version: [15.x, 16.x, 17.x, 18.x, 19.x, latest]
3852
steps:
39-
- uses: actions/checkout@v4
53+
- name: Harden Runner
54+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
55+
with:
56+
egress-policy: audit
57+
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
4060
- name: Run prod version with Node v${{ matrix.node-version }}
41-
uses: useblacksmith/setup-node@v5
61+
uses: useblacksmith/setup-node@65c6ca86fdeb0ab3d85e78f57e4f6a7e4780b391 # v5.0.4
4262
with:
4363
node-version: ${{ matrix.node-version }}
44-
- uses: actions/download-artifact@master
64+
65+
- uses: actions/download-artifact@2a5974104b6d5dbdb2f9468a3e54da3bdd241578 # master
4566
with:
4667
name: dist
4768
path: dist/
48-
- uses: actions/download-artifact@master
69+
70+
- uses: actions/download-artifact@2a5974104b6d5dbdb2f9468a3e54da3bdd241578 # master
4971
with:
5072
name: node_modules
5173
path: ./
74+
5275
- run: tar -xvf node_modules.tar
5376
- run: yarn test-only
5477

5578
test_browser:
79+
permissions:
80+
contents: read
5681
needs: Build
5782
runs-on: blacksmith-4vcpu-ubuntu-2204
5883
steps:
59-
- uses: actions/checkout@v4
60-
- uses: actions/download-artifact@master
84+
- name: Harden Runner
85+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
86+
with:
87+
egress-policy: audit
88+
89+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90+
91+
- uses: actions/download-artifact@2a5974104b6d5dbdb2f9468a3e54da3bdd241578 # master
6192
with:
6293
name: dist
6394
path: dist/
95+
6496
- run: echo '::warning ::Not able to automate browser tests yet'
6597
- run: '# yarn test-browser-ci'

.github/workflows/codeql.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
schedule:
2121
- cron: '32 13 * * 0'
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
analyze:
2528
name: Analyze
@@ -45,12 +48,17 @@ jobs:
4548
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
4649

4750
steps:
51+
- name: Harden Runner
52+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
53+
with:
54+
egress-policy: audit
55+
4856
- name: Checkout repository
49-
uses: actions/checkout@v4
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5058

5159
# Initializes the CodeQL tools for scanning.
5260
- name: Initialize CodeQL
53-
uses: github/codeql-action/init@v3
61+
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
5462
with:
5563
languages: ${{ matrix.language }}
5664
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -64,7 +72,7 @@ jobs:
6472
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6573
# If this step fails, then you should remove it and run the build manually (see below)
6674
- name: Autobuild
67-
uses: github/codeql-action/autobuild@v3
75+
uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
6876

6977
# ℹ️ Command-line programs to run using the OS shell.
7078
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -77,6 +85,6 @@ jobs:
7785
# ./location_of_script_within_repo/buildscript.sh
7886

7987
- name: Perform CodeQL Analysis
80-
uses: github/codeql-action/analyze@v3
88+
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
8189
with:
8290
category: "/language:${{matrix.language}}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0

.github/workflows/scorecard.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
# actions: read
3232

3333
steps:
34+
- name: Harden Runner
35+
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
36+
with:
37+
egress-policy: audit
38+
3439
- name: "Checkout code"
3540
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3641
with:

0 commit comments

Comments
 (0)