mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-31 10:47:27 +07:00
Add authorization header to GitHub API call when COMPOSER_TOKEN is set
This commit is contained in:
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -874,10 +874,15 @@ exports.getInput = getInput;
|
||||
async function fetch(input_url) {
|
||||
const fetch_promise = new Promise(resolve => {
|
||||
const url_object = new url.URL(input_url);
|
||||
const auth_token = process.env['COMPOSER_TOKEN'] || '';
|
||||
const auth_header = auth_token ? 'Bearer' + auth_token : '';
|
||||
const options = {
|
||||
hostname: url_object.hostname,
|
||||
path: url_object.pathname,
|
||||
headers: { 'User-Agent': 'setup-php' }
|
||||
headers: {
|
||||
authorization: auth_header,
|
||||
'User-Agent': 'setup-php'
|
||||
}
|
||||
};
|
||||
const req = https.get(options, (res) => {
|
||||
res.setEncoding('utf8');
|
||||
|
Reference in New Issue
Block a user