4
4
jobs :
5
5
build-and-deploy :
6
6
runs-on : ubuntu-latest
7
- permissions : write-all
7
+ permissions :
8
+ contents : write
9
+ gists : write
8
10
steps :
9
11
- name : Checkout repository
10
12
uses : actions/checkout@master
36
38
- run : pnpm build-storybook
37
39
- run : pnpm test-unit
38
40
- run : pnpm lint
39
- # - run: pnpm tsx scripts/buildNpmReact.ts
40
- - run : nohup pnpm prod-start &
41
- - run : nohup pnpm test-mc-server &
42
- - uses : cypress-io/github-action@v5
43
- with :
44
- install : false
45
- - uses : actions/upload-artifact@v4
46
- if : failure()
47
- with :
48
- name : cypress-images
49
- path : cypress/screenshots/
50
- # - run: node scripts/outdatedGitPackages.mjs
51
- # if: ${{ github.event.pull_request.base.ref == 'release' }}
52
- # env:
53
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
41
55
42
- name : Parse Bundle Stats
56
43
run : |
@@ -62,12 +49,19 @@ jobs:
62
49
- name : Compare Bundle Stats
63
50
id : compare
64
51
uses : actions/github-script@v6
52
+ env :
53
+ GIST_TOKEN : ${{ secrets.GIST_TOKEN }}
65
54
with :
66
55
script : |
67
56
const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
68
57
69
58
async function getGistContent() {
70
- const { data } = await github.rest.gists.get({ gist_id: gistId });
59
+ const { data } = await github.rest.gists.get({
60
+ gist_id: gistId,
61
+ headers: {
62
+ authorization: `token ${process.env.GIST_TOKEN}`
63
+ }
64
+ });
71
65
return JSON.parse(data.files['bundle-stats.json'].content || '{}');
72
66
}
73
67
@@ -78,21 +72,47 @@ jobs:
78
72
const comparison = `minecraft.html (normal build gzip)\n${baseStats.total}MB (${baseStats.gzipped}MB compressed) -> ${newStats.total}MB (${newStats.gzipped}MB compressed)`;
79
73
core.setOutput('stats', comparison);
80
74
75
+ # - run: pnpm tsx scripts/buildNpmReact.ts
76
+ - run : nohup pnpm prod-start &
77
+ - run : nohup pnpm test-mc-server &
78
+ - uses : cypress-io/github-action@v5
79
+ with :
80
+ install : false
81
+ - uses : actions/upload-artifact@v4
82
+ if : failure()
83
+ with :
84
+ name : cypress-images
85
+ path : cypress/screenshots/
86
+ # - run: node scripts/outdatedGitPackages.mjs
87
+ # if: ${{ github.event.pull_request.base.ref == 'release' }}
88
+ # env:
89
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90
+
81
91
- name : Store Bundle Stats
82
92
if : github.event.pull_request.base.ref == 'next'
83
93
uses : actions/github-script@v6
94
+ env :
95
+ GIST_TOKEN : ${{ secrets.GIST_TOKEN }}
84
96
with :
85
97
script : |
86
98
const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
87
99
88
100
async function getGistContent() {
89
- const { data } = await github.rest.gists.get({ gist_id: gistId });
101
+ const { data } = await github.rest.gists.get({
102
+ gist_id: gistId,
103
+ headers: {
104
+ authorization: `token ${process.env.GIST_TOKEN}`
105
+ }
106
+ });
90
107
return JSON.parse(data.files['bundle-stats.json'].content || '{}');
91
108
}
92
109
93
110
async function updateGistContent(content) {
94
111
await github.rest.gists.update({
95
112
gist_id: gistId,
113
+ headers: {
114
+ authorization: `token ${process.env.GIST_TOKEN}`
115
+ },
96
116
files: {
97
117
'bundle-stats.json': {
98
118
content: JSON.stringify(content, null, 2)
0 commit comments