Skip to content

Commit 291ead0

Browse files
committed
use token: workaround
1 parent 983b8a1 commit 291ead0

File tree

1 file changed

+38
-18
lines changed

1 file changed

+38
-18
lines changed

.github/workflows/ci.yml

+38-18
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
jobs:
55
build-and-deploy:
66
runs-on: ubuntu-latest
7-
permissions: write-all
7+
permissions:
8+
contents: write
9+
gists: write
810
steps:
911
- name: Checkout repository
1012
uses: actions/checkout@master
@@ -36,21 +38,6 @@ jobs:
3638
- run: pnpm build-storybook
3739
- run: pnpm test-unit
3840
- 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 }}
5441

5542
- name: Parse Bundle Stats
5643
run: |
@@ -62,12 +49,19 @@ jobs:
6249
- name: Compare Bundle Stats
6350
id: compare
6451
uses: actions/github-script@v6
52+
env:
53+
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
6554
with:
6655
script: |
6756
const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
6857
6958
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+
});
7165
return JSON.parse(data.files['bundle-stats.json'].content || '{}');
7266
}
7367
@@ -78,21 +72,47 @@ jobs:
7872
const comparison = `minecraft.html (normal build gzip)\n${baseStats.total}MB (${baseStats.gzipped}MB compressed) -> ${newStats.total}MB (${newStats.gzipped}MB compressed)`;
7973
core.setOutput('stats', comparison);
8074
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+
8191
- name: Store Bundle Stats
8292
if: github.event.pull_request.base.ref == 'next'
8393
uses: actions/github-script@v6
94+
env:
95+
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
8496
with:
8597
script: |
8698
const gistId = '${{ secrets.BUNDLE_STATS_GIST_ID }}';
8799
88100
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+
});
90107
return JSON.parse(data.files['bundle-stats.json'].content || '{}');
91108
}
92109
93110
async function updateGistContent(content) {
94111
await github.rest.gists.update({
95112
gist_id: gistId,
113+
headers: {
114+
authorization: `token ${process.env.GIST_TOKEN}`
115+
},
96116
files: {
97117
'bundle-stats.json': {
98118
content: JSON.stringify(content, null, 2)

0 commit comments

Comments
 (0)