Skip to content

Commit 0040a5b

Browse files
standardised workflows (#1400)
* standardised workflows * package-lock.json updates for build errors
1 parent 945203e commit 0040a5b

File tree

8 files changed

+166
-50
lines changed

8 files changed

+166
-50
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Build and lint
1+
---
2+
name: Build
23

34
on:
45
workflow_call:
@@ -12,31 +13,17 @@ env:
1213
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }}
1314
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
1415

16+
1517
jobs:
1618
build:
1719
name: Build
1820
runs-on: ubuntu-latest
19-
needs:
20-
- prepare
21+
permissions:
22+
contents: read
2123
steps:
22-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2325

2426
- name: Build
2527
uses: ConsenSys/docs-gha/build@main
2628
with:
2729
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
29-
30-
lint:
31-
name: Lint
32-
runs-on: ubuntu-latest
33-
needs:
34-
- prepare
35-
steps:
36-
- uses: actions/checkout@v3
37-
38-
- name: Lint
39-
uses: ConsenSys/docs-gha/lint@main
40-
with:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-

.github/workflows/case.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Check file name case
3+
4+
on:
5+
workflow_call:
6+
secrets:
7+
SEGMENT_ANALYTICS_KEY:
8+
required: true
9+
LD_CLIENT_ID:
10+
required: true
11+
12+
env:
13+
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }}
14+
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
15+
16+
17+
jobs:
18+
case:
19+
name: Check for case being inconsistent
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
folder: ["docs"]
24+
permissions:
25+
contents: read
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Case check action
30+
uses: ConsenSys/docs-gha/case@main
31+
with:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
DOC_DIR: ${{ matrix.folder }}
34+
SKIP_TEST: true

.github/workflows/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Dependency Review'
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: "npm"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "sunday"
10+
assignees:
11+
- "protocol-galileo"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Check file name case
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
case:
11+
name: Check for licences not being allowed
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
folder: ["docs"]
16+
permissions:
17+
contents: read
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Dependency review
22+
uses: ConsenSys/docs-gha/dependency-review@main
23+
with:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Check for lint, spelling and link errors
3+
4+
on:
5+
workflow_call:
6+
secrets:
7+
SEGMENT_ANALYTICS_KEY:
8+
required: true
9+
LD_CLIENT_ID:
10+
required: true
11+
12+
env:
13+
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_KEY }}
14+
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
15+
16+
17+
jobs:
18+
lint:
19+
name: Lint Code Base, Spelling, Link Check
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Lint
27+
uses: ConsenSys/docs-gha/lint@main
28+
with:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
linkCheck:
32+
name: Link Checking
33+
runs-on: ubuntu-latest
34+
strategy:
35+
matrix:
36+
file-extensions: [".md", ".mdx"]
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: LinkCheck
40+
uses: ConsenSys/docs-gha/linkcheck@main
41+
with:
42+
FILE_EXTENSION: ${{ matrix.file-extensions }}

.github/workflows/main.yml

+22-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Check workflows
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Download actionlint
1515
id: download-actionlint
1616
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.22
@@ -19,19 +19,36 @@ jobs:
1919
run: ${{ steps.download-actionlint.outputs.executable }} -color
2020
shell: bash
2121

22-
build-lint:
23-
name: Build and lint
24-
uses: ./.github/workflows/build-lint.yml
22+
build:
23+
name: Build
24+
uses: ./.github/workflows/build.yml
2525
secrets:
2626
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }}
2727
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
2828

29+
lint:
30+
name: Lint
31+
uses: ./.github/workflows/lint.yml
32+
secrets:
33+
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }}
34+
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
35+
36+
case:
37+
name: Case
38+
uses: ./.github/workflows/case.yml
39+
secrets:
40+
SEGMENT_ANALYTICS_KEY: ${{ secrets.SEGMENT_ANALYTICS_DEV_KEY }}
41+
LD_CLIENT_ID: ${{ secrets.LD_CLIENT_ID }}
42+
43+
2944
all-jobs-completed:
3045
name: All jobs completed
3146
runs-on: ubuntu-latest
3247
needs:
3348
- check-workflows
34-
- build-lint
49+
- build
50+
- lint
51+
- case
3552
outputs:
3653
PASSED: ${{ steps.set-output.outputs.PASSED }}
3754
steps:

.github/workflows/security-code-scanner.yml

+9-26
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ name: 'MetaMask Security Code Scanner'
22

33
on:
44
push:
5-
branches: ['main']
5+
branches:
6+
- 'main'
67
pull_request:
7-
branches: ['main']
8+
branches:
9+
- 'main'
810

911
jobs:
1012
run-security-scan:
@@ -14,30 +16,11 @@ jobs:
1416
contents: read
1517
security-events: write
1618
steps:
19+
- uses: actions/checkout@v4
1720
- name: MetaMask Security Code Scanner
18-
uses: MetaMask/Security-Code-Scanner@main
21+
uses: ConsenSys/docs-gha/mm-security-scanner@main
1922
with:
2023
repo: ${{ github.repository }}
21-
paths_ignored: |
22-
.storybook/
23-
'**/__snapshots__/'
24-
'**/*.snap'
25-
'**/*.stories.js'
26-
'**/*.stories.tsx'
27-
'**/*.test.browser.ts*'
28-
'**/*.test.js*'
29-
'**/*.test.ts*'
30-
'**/fixtures/'
31-
'**/jest.config.js'
32-
'**/jest.environment.js'
33-
'**/mocks/'
34-
'**/test*/'
35-
docs/
36-
e2e/
37-
merged-packages/
38-
node_modules
39-
storybook/
40-
test*/
41-
rules_excluded: example
42-
project_metrics_token: ${{ secrets.SECURITY_SCAN_METRICS_TOKEN }}
43-
slack_webhook: ${{ secrets.APPSEC_BOT_SLACK_WEBHOOK }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
SECURITY_SCAN_METRICS_TOKEN: ${{ secrets.SECURITY_SCAN_METRICS_TOKEN }}
26+
APPSEC_BOT_SLACK_WEBHOOK: ${{ secrets.APPSEC_BOT_SLACK_WEBHOOK }}

.github/workflows/trivy.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Trivy
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
trivy:
11+
name: Run trivy scanner
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Trivy
16+
uses: ConsenSys/docs-gha/trivy@main
17+
with:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)