mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-09 01:26:36 +00:00
chore: update gh api fetch
This commit is contained in:
parent
37537d0520
commit
681aa89dcd
2 changed files with 14 additions and 2 deletions
|
|
@ -1,7 +1,13 @@
|
||||||
import { ALL_GETH_COMMITS_URL } from '../constants';
|
import { ALL_GETH_COMMITS_URL } from '../constants';
|
||||||
|
|
||||||
export const fetchLatestReleaseCommit = (versionNumber: string) => {
|
export const fetchLatestReleaseCommit = (versionNumber: string) => {
|
||||||
return fetch(`${ALL_GETH_COMMITS_URL}/${versionNumber}`)
|
const headers = new Headers({
|
||||||
|
// Note: this token expires on Dec 16, 2023
|
||||||
|
// check fine-grained tokens https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#about-personal-access-tokens
|
||||||
|
Authorization: 'Token ' + process.env.GITHUB_TOKEN_READ_ONLY
|
||||||
|
});
|
||||||
|
|
||||||
|
return fetch(`${ALL_GETH_COMMITS_URL}/${versionNumber}`, { headers })
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(commit => commit.sha.slice(0, 8));
|
.then(commit => commit.sha.slice(0, 8));
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
import { LATEST_GETH_RELEASE_URL } from '../constants';
|
import { LATEST_GETH_RELEASE_URL } from '../constants';
|
||||||
|
|
||||||
export const fetchLatestReleaseVersionAndName = () => {
|
export const fetchLatestReleaseVersionAndName = () => {
|
||||||
return fetch(LATEST_GETH_RELEASE_URL)
|
const headers = new Headers({
|
||||||
|
// Note: this token expires on Dec 16, 2023
|
||||||
|
// check fine-grained tokens https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#about-personal-access-tokens
|
||||||
|
Authorization: 'Token ' + process.env.GITHUB_TOKEN_READ_ONLY
|
||||||
|
});
|
||||||
|
|
||||||
|
return fetch(LATEST_GETH_RELEASE_URL, { headers })
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(release => {
|
.then(release => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue