Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

278
Visualizações
Vercel app is deployed using legacy `now-client`, how to force clear cache

I am using a deprecated client to generate vercel builds via the REST API: "now-client": "^5.0.0" The problem is that the build caching is breaking successive builds, and I want to turn it off. The docs state that you can add a query parameter to a REST call to prevent caching.

But, how do I add a query parameter for the Vercel client? Here is my code which is run as a GitHub action

async function run() {
  try {
    const zeitToken = core.getInput('zeit-token');
    const githubToken = core.getInput('repo-token');
    const repoDir = core.getInput('repo-dir');
    const buildDir = core.getInput('build-dir') || '';
    const configPath = core.getInput('config') || 'now.json';

    const nowJson = fs.readFileSync(configPath, 'utf8');
    const options = JSON.parse(nowJson);

    const deployment = await deploy(`${repoDir}/${buildDir}`, zeitToken, options);

    await postComment(formatDeployment(deployment, options.name), githubToken);
  } catch (error) {
    core.setFailed(error.message);
  }
}

async function deploy(path: string, token: string, options: object): Promise<object> {
  for await (const event of now.createLegacyDeployment(path, {
    token,
    ...options
  })) {
    core.debug(event.payload);

    switch (event.type) {
      case 'ready':
        return event.payload;
      case 'error':
        throw event.payload;
    }
  }

  throw new Error('No deployment');
}

function formatDeployment(deployment: object, name?: string): string {
  // @ts-ignore
  const { url } = deployment;

  return `New ${name + ' '}deployment available on now!\n> http://${url}`;
}

async function postComment(body: string, token: string) {
  const octokit = new github.GitHub(token);

  const { owner, repo, number: issue_number } = github.context.issue;

  await octokit.issues.createComment({ owner, repo, issue_number, body })
}
about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda