mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-31 18:57:17 +07:00
Improve support for composer authenticating private respositories
This commit is contained in:
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -622,8 +622,12 @@ const utils = __importStar(__nccwpck_require__(918));
|
||||
async function getSemverVersion(data) {
|
||||
const search = data['version_prefix'] + data['version'];
|
||||
const url = `https://api.github.com/repos/${data['repository']}/git/matching-refs/tags%2F${search}.`;
|
||||
const token = await utils.readEnv('COMPOSER_TOKEN');
|
||||
const response = await fetch.fetch(url, token);
|
||||
let github_token = await utils.readEnv('GITHUB_TOKEN');
|
||||
const composer_token = await utils.readEnv('COMPOSER_TOKEN');
|
||||
if (composer_token && !github_token) {
|
||||
github_token = composer_token;
|
||||
}
|
||||
const response = await fetch.fetch(url, github_token);
|
||||
if (response.error || response.data === '[]') {
|
||||
data['error'] = response.error ?? `No version found with prefix ${search}.`;
|
||||
return data['version'];
|
||||
|
Reference in New Issue
Block a user