Skip to content

Commit

Permalink
Merge pull request #11 from Zenithar/feat_gha_support_github_token
Browse files Browse the repository at this point in the history
feat(gha): support github token.
  • Loading branch information
nscuro authored Feb 25, 2022
2 parents eaa676a + a14c47b commit d4aee0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ function buildDownloadUrl(version) {

async function getReleaseVersionMatchingRange(httpClient, range) {
core.info(`Determining latest release version of cyclonedx-gomod satisfying "${range}"`);
const responseJson = await httpClient.getJson('https://api.github.com/repos/CycloneDX/cyclonedx-gomod/releases');
const responseJson = await httpClient.getJson(
'https://api.github.com/repos/CycloneDX/cyclonedx-gomod/releases',
process.env.GITHUB_TOKEN
? { Authorization: process.env.GITHUB_TOKEN, ...{} }
: {}
);
if (responseJson === null) { // HTTP 404
throw new Error('Fetching latest release of cyclonedx-gomod failed: not found');
} else if (responseJson.statusCode !== 200) {
Expand Down

0 comments on commit d4aee0c

Please sign in to comment.