IntegrateCommand has feature which is "/integrate auto". This command could make the pull request be automatically integrated when it is ready. But there is a bug.
Let's say we have a merge pull request, it has the auto label and it has the merge-conflict label(the pr has some merge conflicts need to be resolved manually).
1. A user pushes a commit to the source branch , it resolves the merge conflict
2. In CheckWorkItem#1, the new commit triggers CheckRun, so pull request bot removes merge-conflict label and added clean and ready
3. The user uses “Merge” button to merge the source branch into target branch in GitHub/GitLab
4. In the end of CheckWorkItem#1, pull request bot finds auto label and ready label, then issues “/integrate” command
5. When processing the /integrate command, pull request bot finds it’s not able to merge.
6. In another CheckWorkItem#2, nothing in the pull request has changed, so CheckRun will be skipped. But in the end of CheckWorkItem#2, pr bot will find auto label and ready label, and will issue another“/integrate” command
So the pull request bot will be stuck in a loop of step 4,5,6.
To resolve this issue, as Erik suggested, in step4, we should check if the pr is still open.
Let's say we have a merge pull request, it has the auto label and it has the merge-conflict label(the pr has some merge conflicts need to be resolved manually).
1. A user pushes a commit to the source branch , it resolves the merge conflict
2. In CheckWorkItem#1, the new commit triggers CheckRun, so pull request bot removes merge-conflict label and added clean and ready
3. The user uses “Merge” button to merge the source branch into target branch in GitHub/GitLab
4. In the end of CheckWorkItem#1, pull request bot finds auto label and ready label, then issues “/integrate” command
5. When processing the /integrate command, pull request bot finds it’s not able to merge.
6. In another CheckWorkItem#2, nothing in the pull request has changed, so CheckRun will be skipped. But in the end of CheckWorkItem#2, pr bot will find auto label and ready label, and will issue another“/integrate” command
So the pull request bot will be stuck in a loop of step 4,5,6.
To resolve this issue, as Erik suggested, in step4, we should check if the pr is still open.