Skip to content

Commit 16ef37f

Browse files
peter-murrayIvan Zosimov
and
Ivan Zosimov
authored
HTTP errors when the token is undefined (#556)
* Fixing issues with the handling of the token and avoiding error on when the token is undefined * chore: rebuild action --------- Co-authored-by: Ivan Zosimov <[email protected]>
1 parent a237454 commit 16ef37f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

dist/cleanup/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -87931,9 +87931,11 @@ function getGitHubHttpHeaders() {
8793187931
const token = core.getInput('token');
8793287932
const auth = !token ? undefined : `token ${token}`;
8793387933
const headers = {
87934-
authorization: auth,
8793587934
accept: 'application/vnd.github.VERSION.raw'
8793687935
};
87936+
if (auth) {
87937+
headers.authorization = auth;
87938+
}
8793787939
return headers;
8793887940
}
8793987941
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;

dist/setup/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -125282,9 +125282,11 @@ function getGitHubHttpHeaders() {
125282125282
const token = core.getInput('token');
125283125283
const auth = !token ? undefined : `token ${token}`;
125284125284
const headers = {
125285-
authorization: auth,
125286125285
accept: 'application/vnd.github.VERSION.raw'
125287125286
};
125287+
if (auth) {
125288+
headers.authorization = auth;
125289+
}
125288125290
return headers;
125289125291
}
125290125292
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;

src/util.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,13 @@ export function convertVersionToSemver(version: number[] | string) {
166166
export function getGitHubHttpHeaders(): OutgoingHttpHeaders {
167167
const token = core.getInput('token');
168168
const auth = !token ? undefined : `token ${token}`;
169+
169170
const headers: OutgoingHttpHeaders = {
170-
authorization: auth,
171171
accept: 'application/vnd.github.VERSION.raw'
172172
};
173+
174+
if (auth) {
175+
headers.authorization = auth;
176+
}
173177
return headers;
174178
}

0 commit comments

Comments
 (0)