Skip to content

Conversation

ashwinb
Copy link
Contributor

@ashwinb ashwinb commented Oct 3, 2025

Summary

This PR adds a comment-triggered GitHub Actions workflow that allows running pre-commit hooks on-demand for any pull request. When someone comments @github-actions run precommit on a PR, the bot automatically runs all pre-commit hooks and commits any formatting or linting fixes directly to the PR branch.

The implementation uses a secure two-workflow approach: a trigger workflow validates permissions and dispatches to an execution workflow that runs pre-commit in a privileged context. This works safely for both same-repo and fork PRs, with permission checks ensuring only PR authors or repository collaborators can trigger the bot.

🤖 Generated with Claude Code

Add GitHub Actions workflow that allows running pre-commit hooks on-demand via PR comments. Users can comment "@github-actions run precommit" to trigger automatic formatting and linting with auto-commit of fixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 3, 2025
@ashwinb
Copy link
Contributor Author

ashwinb commented Oct 3, 2025

yolo landing lets see if it works

@ashwinb ashwinb merged commit 5a44b9f into main Oct 3, 2025
5 checks passed
@ashwinb ashwinb deleted the remote-precommit branch October 3, 2025 18:51
@leseb
Copy link
Collaborator

leseb commented Oct 6, 2025

Screenshot 2025-10-06 at 10 17 56

woot woot, love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants