gitea api call to detect PR that result in empty commit reddit / selfhosted ---------------------------------------------------------------------- rafipiccolo ยท 2023-11-30 21:28 i have a bot creating pull requests. sometime it creates 2 identical commits on 2 branches and sends 2 PRs. i have another bot that merges pull requests. When he merges the first one it's ok, but then when he tries the second PR it fails to merge. and every time it retries it says the same error : ``` git commit [root/infra:renovate -> root/infra:master]: exit status 1\nOn branch base\nYou are in a sparse checkout with 2% of tracked files present.\n\nChanges not staged for commit:\n (use \"git add/rm ...\" to update what will be committed)\n (use \"git restore ...\" to discard changes in working directory)\n\tdeleted: package- lock.json\n\tdeleted: package.json\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n","url":"https://gitea.xxxx.com/api/swagger"} ``` when i go in the UX to check the PR it shows a warning : " The changes on this branch are already on the target branch. This will be an empty commit. " i think i have tested all endpoints of the api related to pulls and diff and i dont know how to detect this fact. i'd like to know that this merge would result in empty commit, so i could just automatically delete the PR. any advice ?