Skip to content

Commit 6cd9c68

Browse files
authored
Partially sync GitHub workflows with module template (#221)
Don't bring over all of the GitHub workflows from the module template, but use the `checkout-and-setup` action so that we don't get errors about using a deprecated version of `actions/cache`.
1 parent d4bdac9 commit 6cd9c68

File tree

4 files changed

+30
-53
lines changed

4 files changed

+30
-53
lines changed

.github/workflows/build-test.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,14 @@ jobs:
1313
matrix:
1414
node-version: [18.x, 20.x]
1515
steps:
16-
- uses: actions/checkout@v4
17-
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v4
16+
- name: Checkout and setup environment
17+
uses: MetaMask/action-checkout-and-setup@v1
1918
with:
19+
is-high-risk-environment: false
2020
node-version: ${{ matrix.node-version }}
21-
- name: Get Yarn cache directory
22-
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn cache dir)"
23-
id: yarn-cache-dir
24-
- name: Get Yarn version
25-
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
26-
id: yarn-version
27-
- name: Cache yarn dependencies
28-
uses: actions/cache@v2
29-
with:
30-
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
31-
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
32-
- run: yarn --frozen-lockfile
21+
cache-node-modules: ${{ matrix.node-version == '20.x' }}
3322
- run: yarn allow-scripts
3423
- run: yarn build
35-
- run: yarn lint
3624
- run: yarn test
3725
- name: Validate RC changelog
3826
if: ${{ startsWith(github.head_ref, 'release/') }}

.github/workflows/create-release-pr.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
default: 'main'
99
required: true
1010
release-type:
11-
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
11+
description: 'A SemVer version diff, i.e. major, minor, or patch. Mutually exclusive with "release-version".'
1212
required: false
1313
release-version:
1414
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
@@ -21,30 +21,22 @@ jobs:
2121
contents: write
2222
pull-requests: write
2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout and setup environment
25+
uses: MetaMask/action-checkout-and-setup@v1
2526
with:
26-
# This is to guarantee that the most recent tag is fetched.
27-
# This can be configured to a more reasonable value by consumers.
27+
is-high-risk-environment: true
28+
29+
# This is to guarantee that the most recent tag is fetched. This can
30+
# be configured to a more reasonable value by consumers.
2831
fetch-depth: 0
32+
2933
# We check out the specified branch, which will be used as the base
3034
# branch for all git operations and the release PR.
3135
ref: ${{ github.event.inputs.base-branch }}
32-
- name: Get Node.js version
33-
id: nvm
34-
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
35-
- uses: actions/setup-node@v4
36-
with:
37-
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
38-
- uses: MetaMask/action-create-release-pr@v1
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- uses: MetaMask/action-create-release-pr@v4
4138
with:
4239
release-type: ${{ github.event.inputs.release-type }}
4340
release-version: ${{ github.event.inputs.release-version }}
44-
artifacts-path: gh-action__release-authors
45-
# Upload the release author artifact for use in subsequent workflows
46-
- uses: actions/upload-artifact@v4
47-
with:
48-
name: release-authors
49-
path: gh-action__release-authors
50-
if-no-files-found: error
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-release.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@ jobs:
88
publish-release:
99
permissions:
1010
contents: write
11-
if: |
12-
github.event.pull_request.merged == true &&
13-
startsWith(github.event.pull_request.head.ref, 'release/')
1411
runs-on: ubuntu-latest
1512
steps:
16-
- uses: actions/checkout@v4
13+
- name: Checkout and setup environment
14+
uses: MetaMask/action-checkout-and-setup@v1
1715
with:
18-
# We check out the release pull request's base branch, which will be
19-
# used as the base branch for all git operations.
20-
ref: ${{ github.event.pull_request.base.ref }}
21-
- name: Get Node.js version
22-
id: nvm
23-
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
24-
- uses: actions/setup-node@v4
25-
with:
26-
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
27-
- uses: MetaMask/action-publish-release@v1
16+
is-high-risk-environment: true
17+
ref: ${{ github.sha }}
18+
- uses: MetaMask/action-publish-release@v3
2819
env:
2920
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ on:
77
pull_request:
88
branches:
99
- main
10-
workflow_dispatch:
10+
workflow_call:
11+
secrets:
12+
SECURITY_SCAN_METRICS_TOKEN:
13+
required: false
14+
APPSEC_BOT_SLACK_WEBHOOK:
15+
required: false
1116

1217
jobs:
1318
run-security-scan:
19+
name: Run security scan
1420
runs-on: ubuntu-latest
1521
permissions:
1622
actions: read
1723
contents: read
1824
security-events: write
1925
steps:
20-
- name: MetaMask Security Code Scanner
21-
uses: MetaMask/Security-Code-Scanner@main
26+
- name: Analyse code
27+
uses: MetaMask/action-security-code-scanner@v1
2228
with:
2329
repo: ${{ github.repository }}
2430
paths_ignored: |

0 commit comments

Comments
 (0)