INNER CODE UNIT · JavaScript

realVersion

infrahq/infra · .github/actions/setup-infra/index.js:18

async function realVersion(version) {
  if (version !== 'latest') {
    return version;
  }

  const latest = new URL('/infrahq/infra/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') {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…