Coder Social home page Coder Social logo

Comments (2)

chingor13 avatar chingor13 commented on August 24, 2024

When trying to append to an existing PR, it looks for the PR with:

const pulls = await octokit.pulls.list({
owner: params.destRepo.owner,
repo: params.destRepo.repo,
state: 'open',
head: `${params.destRepo.owner}:${destBranch}`,
});

This request is not paginated so if the existing PR is not in the most recent X, then it will fail to find that PR.

Edit: this is not the case, this search should not need pagination because it's filtering by PR head branch.

from repo-automation-bots.

chingor13 avatar chingor13 commented on August 24, 2024

Ok, I think I know what's happening here.

We only run the findAndAppendPullRequest if:

  • we find individual API PRs that need updating
  • we found individual API PRs that need updating and find the rest of the APIs

We are currently not trying to look for an existing PR if there were no individual open PRs. We are getting to

const destBranch = branchNameForCopies(leftOverBatch);
cmd(`git checkout ${defaultBranch}`, {cwd: destDir});
cmd(`git checkout -b ${destBranch}`, {cwd: destDir});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reportError = async (e: any, yamlPath: string) => {
console.error(`Error parsing ${yamlPath}: ${e}`);
const sourceLink = sourceLinkFrom(params.sourceRepoCommitHash);
const octokit = await params.octokitFactory.getShortLivedOctokit();
const issue = await octokit.issues.create({
owner: params.destRepo.owner,
repo: params.destRepo.repo,
title: `${yamlPath} is missing or defective`,
body: `While attempting to copy files from
${sourceLink}
After fixing ${yamlPath}, re-attempt this copy by running the following
command in a local clone of this repo:
\`\`\`
docker run -v /repo:$(pwd) -w /repo gcr.io/repo-automation-bots/owl-bot -- copy-code \
--source-repo-commit-hash ${params.sourceRepoCommitHash}
\`\`\``,
});
const copyTag = copyTagFrom(yamlPath, params.sourceRepoCommitHash);
console.log(`Created issue ${issue.data.html_url}`);
await params.copyStateStore.recordBuildForCopy(
params.destRepo,
copyTag,
issue.data.html_url
);
};
// Copy the code from googleapis-gen.
const copiedYamls = await copyCodeIntoCommit(
wparams,
leftOverBatch,
reportError,
logger
);
if (copiedYamls.length === 0) {
continue; // Nothing was copied; don't create a pull request.
}
// Create a pull request.
const apiNames = copiedYamls
.map(tag => tag.yaml['api-name'])
.filter(Boolean);
const apiList = abbreviateApiListForTitle(apiNames as string[]);
const token = await params.octokitFactory.getGitHubShortLivedAccessToken();
const pushUrl = params.destRepo.getCloneUrl(token);
const pull = await createPullRequestFromLastCommit(
params.destRepo.owner,
params.destRepo.repo,
destDir,
destBranch,
pushUrl,
[OWL_BOT_COPY],
await params.octokitFactory.getShortLivedOctokit(token),
WithRegenerateCheckbox.Yes,
apiList,
Force.Yes,
logger
);
// Record that we've copied the code.
for (const yaml of copiedYamls) {
await params.copyStateStore.recordBuildForCopy(
params.destRepo,
yaml.copyTag,
pull
);
}
}
which by itself does not look for an existing PR.

from repo-automation-bots.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.