Skip to content

Commit 7c10eb3

Browse files
authored
feat: add team label reusable workflow (#23)
* feat: add workflow * Update add-team-label.yml * feat: use composite action * Update build-lint-test.yml * fix: lint
1 parent 3222133 commit 7c10eb3

File tree

5 files changed

+59
-36
lines changed

5 files changed

+59
-36
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Setup environment
2+
description: Setup environment
3+
runs:
4+
using: composite
5+
steps:
6+
- run: corepack enable
7+
shell: bash
8+
9+
- name: Set up Node.js
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version-file: .nvmrc
13+
cache: yarn
14+
15+
- name: Install dependencies
16+
run: yarn --immutable
17+
shell: bash

.github/workflows/add-team-label.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Add team label
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
PERSONAL_ACCESS_TOKEN:
7+
required: true
8+
9+
jobs:
10+
add-team-label:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup environment
17+
uses: metamask/github-tools/.github/actions/setup-environment@main
18+
19+
- name: Add team label
20+
env:
21+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
22+
run: yarn run add-team-label

.github/workflows/build-lint-test.yml

+14-33
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,17 @@ on:
44
workflow_call:
55

66
jobs:
7-
prepare:
8-
name: Prepare
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v3
12-
- name: Use Node.js
13-
uses: actions/setup-node@v3
14-
with:
15-
node-version-file: '.nvmrc'
16-
cache: 'yarn'
17-
- name: Install Yarn dependencies
18-
run: yarn --immutable
19-
207
lint:
21-
name: Lint
228
runs-on: ubuntu-latest
23-
needs:
24-
- prepare
259
steps:
26-
- uses: actions/checkout@v3
27-
- name: Use Node.js
28-
uses: actions/setup-node@v3
29-
with:
30-
node-version-file: '.nvmrc'
31-
cache: 'yarn'
32-
- run: yarn --immutable --immutable-cache
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Setup environment
14+
uses: ./.github/actions/setup-environment
15+
3316
- run: yarn lint
17+
3418
- name: Require clean working directory
3519
shell: bash
3620
run: |
@@ -40,19 +24,16 @@ jobs:
4024
fi
4125
4226
test:
43-
name: Test
4427
runs-on: ubuntu-latest
45-
needs:
46-
- prepare
4728
steps:
48-
- uses: actions/checkout@v3
49-
- name: Use Node.js
50-
uses: actions/setup-node@v3
51-
with:
52-
node-version-file: '.nvmrc'
53-
cache: 'yarn'
54-
- run: yarn --immutable --immutable-cache
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Setup environment
33+
uses: ./.github/actions/setup-environment
34+
5535
- run: yarn test
36+
5637
- name: Require clean working directory
5738
shell: bash
5839
run: |

.github/workflows/main.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ jobs:
1010
name: Check workflows
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
1416
- name: Download actionlint
1517
id: download-actionlint
1618
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23
1719
shell: bash
20+
1821
- name: Check workflow files
1922
run: ${{ steps.download-actionlint.outputs.executable }} -color
2023
shell: bash

.yarnrc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ nodeLinker: node-modules
1010

1111
plugins:
1212
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
13-
spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js"
13+
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'
1414
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
15-
spec: "@yarnpkg/plugin-constraints"
15+
spec: '@yarnpkg/plugin-constraints'
1616

1717
yarnPath: .yarn/releases/yarn-3.2.1.cjs

0 commit comments

Comments
 (0)