Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!