INNER CODE UNIT · JavaScript
realVersion
infrahq/infra · .github/actions/setup-argocd/index.js:18
async function realVersion(project, version) {
if (version !== 'latest') {
return version;
}
const latest = new URL(`/${project}/releases/latest`, base);
const client = new http.HttpClient('', '', { allowRedirects: false });
const res = await client.head(latest);
if (!HttpRedirectCodes.includes(res.message.statusCode)) {
throw new Error('Did not get expected redirect');
}
const location = new URL(res.message.headers.location);
let newVersion = path.basename(location.pathname);
if (newVersion[0] === 'v') {