-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (118 loc) · 3.64 KB
/
pr-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: PR Check
on:
pull_request:
paths:
- 'packages/auto-story-generator/**'
jobs:
init:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cache-name: cache-node-modules
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Set git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9.12.2
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-store-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ env.cache-name }}-
- name: Install Node Dependencies
run: pnpm install
- name: Set .npmrc
run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
# Output the cache-name environment variable
# so that it can be used in other jobs
outputs:
cache-name: ${{ env.cache-name }}
type-check:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: init
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v2
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-store-${{ needs.init.outputs.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Type check
run: pnpm p:core lint:type-check
eslint-check:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: init
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v2
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-store-${{ needs.init.outputs.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: ESlint check
run: pnpm p:core lint
build-check:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: init
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v2
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-store-${{ needs.init.outputs.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Build check
run: pnpm p:core build
publish-check:
permissions:
contents: write
packages: write
actions: write
checks: write
deployments: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [init, build-check]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v2
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-store-${{ needs.init.outputs.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Publish check
run: pnpm p:core release:test