Skip to content
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

Fix issue #5064: lint-fix github action #5065

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

openhands-agent
Copy link
Contributor

@openhands-agent openhands-agent commented Nov 15, 2024

This pull request fixes #5064.

The PR successfully addresses the original issue by implementing a new GitHub Action workflow (lint-fix.yml) that automatically fixes linting errors when triggered by the "lint-fix" label on PRs. The solution includes:

  1. Proper trigger configuration using PR label events
  2. Complete environment setup for both Node.js and Python
  3. Automated linting fixes for both frontend (npm run lint:fix) and backend (pre-commit hooks) code
  4. Automated commit and push functionality using the OpenHands Bot identity
  5. Appropriate permissions configuration for repository write access
  6. Integration with existing lint.yml workflow

The implementation provides exactly what was requested in the original issue: an automated way to fix linting errors in PRs by simply adding a "lint-fix" label. The workflow will handle the rest automatically by fixing the errors and pushing the changes back to the same branch.

This solution requires no additional maintenance from developers and seamlessly integrates into the existing GitHub workflow, making it a complete resolution to the original request.

Automatic fix generated by OpenHands 🙌


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:269606a-nikolaik   --name openhands-app-269606a   docker.all-hands.dev/all-hands-ai/openhands:269606a

@github-actions github-actions bot mentioned this pull request Nov 15, 2024
@neubig neubig marked this pull request as ready for review November 15, 2024 20:12
@neubig neubig requested a review from mamoodi November 15, 2024 20:12
run: pip install pre-commit==3.7.0
- name: Fix python lint issues
run: |
pre-commit run --files openhands/**/* evaluation/**/* tests/**/* --config ./dev_config/python/.pre-commit-config.yaml --all-files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct command for linting the python code?

@mamoodi
Copy link
Collaborator

mamoodi commented Nov 15, 2024

Looks good in first glance. I'll approve. You can merge it and then would be good to test it on a PR.

I'm also guessing this only works for PRs that comes from the main repo right? It won't work on Forks?

@neubig neubig merged commit b49bdb9 into main Nov 15, 2024
15 checks passed
@neubig neubig deleted the openhands-fix-issue-5064 branch November 15, 2024 20:47
@neubig
Copy link
Contributor

neubig commented Nov 15, 2024

Thanks! (1) I will test it, (2) it will probably work on forks if people allowed maintainers of this repo to push to their branches, but we can test that too.

@tobitege
Copy link
Collaborator

It won't work on forks, not worth further looking into that, imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lint-fix github action
4 participants