quarkus-github-bot
quarkus-github-bot copied to clipboard
Add support for test/retest command in pull request comment
This branch aims to add commands handling on pull request command.
On a pull request comment, it :
- check this is a comment on a pull request
- the user that commented this is not
@quarkus-bot
- validate the user is part the
quarkus-push
teams
Once it is ok, it looks for a Command
bean that match the comment body.
The RerunWorkflowCommand
accepts test
and retest
allowing:
-
@quarkus-bot test
command -
@quarkus-bot retest
command
Regarding the workflow, it looks for Quarkus CI WorkflowRun
, take the last one, and rerun
it.
I created the PR in draft as I'm not able to get a working rerun
, no error, is thrown by the API. When I log the url of the workflow that should be rerun, it is the correct one. This may come from my repo not providing enough permissions but I'm not able to find what's missing, maybe @gsmet you will have some hints?
Thanks @gsmet, returning a ReactionContent
is a really good idea.
I'm still unable to get a rerun
running. My app request Read & Write
permissions on actions. And I review those permissions in the repo but nothing change.
@glefloch I'll have a look tomorrow.
Rebased and pushed a formatting fix. I will have a look to the behavior now.
I pushed a few improvements but... I have the same issue you have. Root cause is we get a 403 with this error:
Caused by: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/gsmet/quarkus-bot-java-playground/actions/runs/764523023/rerun {"message":"Invalid run_id `764523023`","documentation_url":"https://docs.github.com/rest/reference/actions#re-run-a-workflow"}
Rerun is working fine in the GitHub API tests so I'm not sure what is going on here...
It's working fine with the same ID? the url built by the client looks correct.
Yeah the URL looks correct and is the exact same than the one provided by GitHub in the cancelUrl field of the workflow run object. There's definitely something fishy going on but I have no idea what :/
I experimented a lot with this.
There seems to be a problem on the GitHub side. Doing the exact same call with a personal access token works and I'm positive the permissions are correct given I can cancel a workflow.
I contacted the GitHub support. I'll let you know how it goes.
Thanks a lot for the investigation @gsmet !
@glefloch so the GitHub team confirmed to me it's a bug on their side. No ETA for the fix, I'll work on a workaround tonight and push a commit for you to review.
Nice thanks!
@glefloch I pushed the workaround, could you have a look? I tested it and it seems to work.
@gsmet it looks good to me!
@gsmet, I tested it with my playground bot and it works well.
WDYT of keeping 2 separate commits, one with the handler and one with the custom rerun
code ?