Move custom scripts docs (#8386)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Robert Brennan 2025-05-09 10:34:03 -04:00 committed by GitHub
parent f8faa28bb1
commit 29f3e028e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View File

@ -99,13 +99,6 @@ check out our [documentation](https://docs.all-hands.dev/modules/usage/getting-s
There you'll find resources on how to use different LLM providers,
troubleshooting resources, and advanced configuration options.
### Custom Scripts
OpenHands supports custom scripts that run at different points in the runtime lifecycle:
- **setup.sh**: Place this script in the `.openhands` directory of your repository to run custom setup commands when the runtime initializes.
- **pre-commit.sh**: Place this script in the `.openhands` directory to add a custom git pre-commit hook that runs before each commit. This can be used to enforce code quality standards, run tests, or perform other checks before allowing commits.
## 🤝 How to Join the Community
OpenHands is a community-driven project, and we welcome contributions from everyone. We do most of our communication

View File

@ -21,3 +21,27 @@ sudo apt-get update
sudo apt-get install -y lsof
cd frontend && npm install ; cd ..
```
## Pre-commit Script
You can add a `.openhands/pre-commit.sh` file to create a custom git pre-commit hook that runs before each commit.
This can be used to enforce code quality standards, run tests, or perform other checks before allowing commits.
For example:
```bash
#!/bin/bash
# Run linting checks
cd frontend && npm run lint
if [ $? -ne 0 ]; then
echo "Frontend linting failed. Please fix the issues before committing."
exit 1
fi
# Run tests
cd backend && pytest tests/unit
if [ $? -ne 0 ]; then
echo "Backend tests failed. Please fix the issues before committing."
exit 1
fi
exit 0
```