Skip to content

Commit ef2fa7b

Browse files
committed
chore: update script
1 parent a0ad1a2 commit ef2fa7b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

apps/core/get-latest-admin-version.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@ const Package = require('./package.json')
88
const endpoint = `https://api.github.com/repos/${repo}/releases/latest`
99

1010
const latestVersion = async () => {
11-
const res = await axios.get(endpoint).catch((error) => {
12-
console.error(error.message)
13-
process.exit(1)
14-
})
11+
const res = await axios
12+
.get(endpoint, {
13+
headers: {
14+
'User-Agent':
15+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
16+
Authorization: process.env.GH_TOKEN
17+
? `Bearer ${process.env.GH_TOKEN}`
18+
: undefined,
19+
},
20+
})
21+
.catch((error) => {
22+
console.error(error.message)
23+
process.exit(1)
24+
})
1525
return res.data.tag_name.replace(/^v/, '')
1626
}
1727
async function main() {

0 commit comments

Comments
 (0)