Repository navigation
[Merged by Bors] - feat: run style linters in fix mode and push a commit when "bot fix style" is posted in a PR comment - #15781
bryangingechen wants to merge 17 commits into
Conversation
PR summary 76accb4619Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diffNo declarations were harmed in the making of this PR! 🐙 You can run this locally as follows## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for |
|
Let's make sure nothing explodes if I do this: bot fix style |
|
Ah, it makes sense that the workflow that triggers on comments won't run from a PR. |
You may still be able to test this by modifying a workflow that reacts to comments that already is in master. As far as I can tell, if the workflow file is in master, then PRs modifying it work with the modified script. So you could override the |
|
This will conflict with #15051, so I'll work on this more after that one is merged. |
|
This PR/issue depends on:
|
3eb87b4 to
76f3d2f
Compare
76f3d2f to
5b74a73
Compare
|
bot fix style |
|
Hmm, unfortunately the trick of overwriting the maintainer merge workflow didn't work. The run for the "bot fix style" comment above shows that the workflow on |
|
This can be tested in my fork of mathlib4. The main things left to test are permissions and other edge cases. So feel free to open weird issues / PRs to my fork and comment on them to try and break things. I think only people with write access should be able to trigger the bot now, so if you want write access to my fork let me know here or on Zulip! For starters, if someone would like to try commenting
|
| fix_style: | ||
| name: Fix style issues from lint | ||
| if: github.repository == 'leanprover-community/mathlib4' && (github.event.issue.pull_request != 'null') && github.event.pull_request.draft == false && (startsWith(github.event.comment.body, 'bot fix style') || contains(toJSON(github.event.comment.body), '\nbot fix style')) | ||
| if: github.repository == 'leanprover-community/mathlib4' && github.event.issue.pull_request && github.event.pull_request.draft == false && (startsWith(github.event.comment.body, 'bot fix style') || contains(toJSON(github.event.comment.body), '\nbot fix style')) |
There was a problem hiding this comment.
reminder to self: this needs to be fixed (in another PR) in the maintainer merge workflows as well
|
|
||
| - run: echo ${{ steps.user_permission.outputs.require-result }} | ||
|
|
||
| # Maybe no API exists for this yet? |
There was a problem hiding this comment.
Is there a way to add a reaction to a PR review via the API? I tried the following and it gave me a 404 (I'm pretty sure the token I used has the permissions necessary): https://github.com/bryangingechen/mathlib4/actions/runs/10534530644/job/29192315609#step:4:14
…tyle" is posted in a PR comment (#15781) The bot is triggered when writes "bot fix style" on a PR, either in an ordinary comment, a review comment, or a review. It then checks if the author has "write" privileges (or above) and if so, will react with a 🚀 emoji on the triggering comment and then lint and push a commit to the PR branch. Note that this uses the NIGHTLY_TESTING secret. See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reviewdog/near/460017984).
|
Pull request successfully merged into master. Build succeeded: |
…tyle" is posted in a PR comment (#15781) The bot is triggered when writes "bot fix style" on a PR, either in an ordinary comment, a review comment, or a review. It then checks if the author has "write" privileges (or above) and if so, will react with a 🚀 emoji on the triggering comment and then lint and push a commit to the PR branch. Note that this uses the NIGHTLY_TESTING secret. See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reviewdog/near/460017984).
…tyle" is posted in a PR comment (#15781) The bot is triggered when writes "bot fix style" on a PR, either in an ordinary comment, a review comment, or a review. It then checks if the author has "write" privileges (or above) and if so, will react with a 🚀 emoji on the triggering comment and then lint and push a commit to the PR branch. Note that this uses the NIGHTLY_TESTING secret. See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reviewdog/near/460017984).
…tyle" is posted in a PR comment (#15781) The bot is triggered when writes "bot fix style" on a PR, either in an ordinary comment, a review comment, or a review. It then checks if the author has "write" privileges (or above) and if so, will react with a 🚀 emoji on the triggering comment and then lint and push a commit to the PR branch. Note that this uses the NIGHTLY_TESTING secret. See [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/reviewdog/near/460017984).
The bot is triggered when writes "bot fix style" on a PR, either in an ordinary comment, a review comment, or a review. It then checks if the author has "write" privileges (or above) and if so, will react with a 🚀 emoji on the triggering comment and then lint and push a commit to the PR branch.
Note that this uses the NIGHTLY_TESTING secret.
See Zulip.
lint-style.sh#15051This can be tested in my fork of mathlib4. The main things left to test are permissions and other edge cases. So feel free to open weird issues / PRs to my fork and comment on them to try and break things. I think only people with write access should be able to trigger the bot now, so if you want write access to my fork let me know here or on Zulip!
For starters, if someone would like to try commenting
bot fix styleon bryangingechen#2 (also in a PR review / PR review comment) I can check if the permissions check is working properly. (Since no one other than me has write access at this time, hopefully the bot will ignore your comment.)