-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[misc] feat: introduce a style bot. #10274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type of workflow event will only trigger if the workflow is on the default branch so we can't test it here, but it appears correct and is working on your test repo. My only comment is that make style && make quality
can just be make style
and sometimes we need to do ruff check $(check_dirs) setup.py --fix --unsafe-fixes
, probably better to do --unsafe-fixes
manually though.
This event will only trigger a workflow run if the workflow file is on the default branch.
Yeah usually
Yeah exactly. Sorry, I should have made it clear. My ask was more about checking the structure of the workflow and the dummy repo I tested it on. @DN6 could you give this a look too? |
.github/workflows/pr_style_bot.yml
Outdated
git add . | ||
git commit -m "Apply style fixes" | ||
# Push back to the PR branch | ||
git push origin HEAD:${{ steps.pr_info.outputs.headRef }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will push to diffusers/headRef
instead of the original contributor's forked repo'branch (if it is from a forked repository) - If I am not making mistake here.
Better to revise this part I think :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I PoC'd it here: https://github.com/sayakpaul/poc-style-bot in sayakpaul/poc-style-bot#1.
If you have ideas about revisions, please provide them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because your PR is opened by a branch pushed to the same repository. To actually test the situation, you have to fork the repository poc-style-bot
say to (under another github account sayakapaul_2
), push a branch to sayakapaul_2/poc-style-bot
, and opening a PR in sayakpaul/poc-style-bot
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ydshieh I pushed some updates to account for your comment here #10274 (comment). LMK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks my comment is addressed, although I didn't check line by line.
I always recommend to test it with a external contributor
(a new github account, say sayakpaul2
) opening a PR from it's forked repo. to your POC repository (under @sayakpaul
).
But I will leave the final decision to you :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with external contributor here sayakpaul/poc-style-bot#2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hlky tested with sayakpaul/poc-style-bot#2.
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you do the same here ? create 3 env variable and use them on the run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the latest changes work?
Co-authored-by: Guillaume LEGENDRE <glegendre01@gmail.com>
- name: Download Makefile from main branch | ||
run: | | ||
curl -o main_Makefile https://raw.githubusercontent.com/huggingface/diffusers/main/Makefile | ||
|
||
- name: Compare Makefiles | ||
run: | | ||
if ! diff -q main_Makefile Makefile; then | ||
echo "Error: The Makefile has changed. Please ensure it matches the main branch." | ||
exit 1 | ||
fi | ||
echo "No changes in Makefile. Proceeding..." | ||
rm -rf main_Makefile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glegendre01 added this too. LMK if it works for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@glegendre01 a gentle ping. |
Thanks all for helping :) |
What does this PR do?
This PR introduces a workflow for allowing us to use the GitHub Actions bot to do
@bot /style
on PRs that are close to merging but cannot be merged because of styling issues.I have experimented with the workflow in this dummy repository: https://github.com/sayakpaul/poc-style-bot.
This is how it'd look like:

Workflow run: https://github.com/sayakpaul/poc-style-bot/actions/runs/12366322159
@hlky possible for you to give this a look and try it out?