E-B-Smith/xcode-github

Refresh Deletes Existing PR Bots + Restarts ongoing Integration

Closed this issue · 5 comments

Hello,

First off - I love this app, and would love to contribute.

I noticed when I have a low refresh time (1 minute), My integrations never complete, because the Refresh deletes and then creates new Bots for the existing PRs. Is this expected behavior? I can just turn down my refresh time, but it would be nice to allow bots with ongoing integrations to not get overwritten

Seems to be an issue with mistaking bots with open PRs for bots that have had their PRs removed.

Relevant code in XGCommand.m

  // Check for bots with no PR and delete it:
        for (XGXcodeBot *bot in bots.objectEnumerator) {
            NSString *number = bot.pullRequestNumber;
            if (number && !pullRequests[number]) {
                error = XGDeleteBotWithOptions(options, bot);
                if (error) { returnCode = EX_NOPERM; goto exit; }
            }
        }

I'm glad you're finding Xcode-GitHub useful!

A few questions:

Does the bot you use as a template have GitHub set as its source control?

Are bots not created by Xcode-GitHub being deleted too?

  1. Yes - Template Bots are using Github as source control.
  2. No - Only Bots created Xcode-Github are being deleted.

My current work around is commenting out the call to XGDeleteBotWithOptions in the code snippet above. I obviously have to delete my bots myself, but it's a better workaround for me. I'd be happy to get in there with the debugger when I find some free moments and try to take a look at why it's not recognizing the bots as having existing PRs.

This isn't happening on my end or I'd fix it right away, obviously.

I wonder if the status your PRs is getting set to something other than 'open'?

NSString *serverURLString =
[NSString stringWithFormat:
@"https://api.github.com/repos/%@/pulls?state=open&sort=created&direction=desc",
repo];

This issue no longer occurs for me. Not sure what the root cause of the issue, but if there's not objection, I'm going to close this issue.