mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2025-12-31 15:02:19 +00:00
feat: use GITHUB_TOKEN when not 3rd party runner and github-token input empty
Signed-off-by: Nicolas Brousse <n.brousse@pantographe.studio>
This commit is contained in:
parent
db353172f3
commit
aee8f86b30
2 changed files with 4 additions and 2 deletions
3
dist/index.js
vendored
3
dist/index.js
vendored
|
|
@ -39,13 +39,14 @@ class Release {
|
||||||
async function fetchReleases () {
|
async function fetchReleases () {
|
||||||
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
|
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
|
||||||
const githubToken = core.getInput('github_token');
|
const githubToken = core.getInput('github_token');
|
||||||
|
const is3rdPartyRunner = process.env.FORGEJO_ACTIONS || process.env.GITEA_ACTIONS;
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
Accept: 'application/vnd.github+json',
|
Accept: 'application/vnd.github+json',
|
||||||
'X-GitHub-Api-Version': '2022-11-28'
|
'X-GitHub-Api-Version': '2022-11-28'
|
||||||
};
|
};
|
||||||
|
|
||||||
if (githubToken) {
|
if (githubToken === '' && !is3rdPartyRunner) {
|
||||||
headers.Authorization = `Bearer ${githubToken}`;
|
headers.Authorization = `Bearer ${githubToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,14 @@ class Release {
|
||||||
async function fetchReleases () {
|
async function fetchReleases () {
|
||||||
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
|
const url = 'https://api.github.com/repos/opentofu/opentofu/releases';
|
||||||
const githubToken = core.getInput('github_token');
|
const githubToken = core.getInput('github_token');
|
||||||
|
const is3rdPartyRunner = process.env.FORGEJO_ACTIONS || process.env.GITEA_ACTIONS;
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
Accept: 'application/vnd.github+json',
|
Accept: 'application/vnd.github+json',
|
||||||
'X-GitHub-Api-Version': '2022-11-28'
|
'X-GitHub-Api-Version': '2022-11-28'
|
||||||
};
|
};
|
||||||
|
|
||||||
if (githubToken) {
|
if (githubToken === '' && !is3rdPartyRunner) {
|
||||||
headers.Authorization = `Bearer ${githubToken}`;
|
headers.Authorization = `Bearer ${githubToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue