mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2025-12-31 15:02:19 +00:00
Add API token header to prevent side effects during tests (#16)
* feat: add API token header to prevent side effects during tests Signed-off-by: Dmitry Kisler <admin@dkisler.com>
This commit is contained in:
parent
5f01fa71eb
commit
6cdd07fc43
3 changed files with 23 additions and 9 deletions
|
|
@ -30,11 +30,17 @@ class Release {
|
|||
async function fetchReleases () {
|
||||
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
|
||||
|
||||
const headers = {
|
||||
Accept: 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
};
|
||||
|
||||
if (process.env.GITHUB_TOKEN) {
|
||||
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
}
|
||||
|
||||
const resp = await fetch(url, {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
headers
|
||||
});
|
||||
|
||||
if (!resp.ok) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue