Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
How to open a list of PRs automatically in Github?

We have a repo (SaaS project) that contains a list of branches (50-100), the master branch is up to date, So I want to open a list of PRs for every branch we have to take updates from

master -> client-*

So is there a way to handle this case automatically?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use Github's API to fetch all of your branches and to publish PRs. Unfortunately, Github doesn't provide a method for filtering when listing branches, so you will still need to apply that filter in your own code.

Here's an example execution using Octokit. The two methods needed are repos.listBranches and pulls.create.

Example Implementation
  // Fetching branches...
  const branches = await userClient.paginate(userClient.rest.repos.listBranches, {
    owner: ownerId,
    repo: reposId,
  });

  // Filtering the retrieved branches.
  const prefixedBranches = branches.filter((branch) => branch.name.startsWith(branchPrefix));
  console.log(`${prefixedBranches.length} branches match the filter`);

  // Creating pull requests...
  const result = await Promise.allSettled(
    prefixedBranches.map((branch) => {
      return userClient.rest.pulls.create({
        title: `Fusebit Generated PR from ${branch.name}`,
        head: branch.name,
        base: targetBranch,
        owner: ownerId,
        repo: reposId,
      });
    })
  );
View in Fusebit
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda