ANS2BOT is a GitHub bot designed to automate and streamline the management of Ansible Collections repositories.
It helps maintainers and contributors by handling common tasks like pull request reviews, issue management, and workflow checks.
- Automated PR review process
- Issue and PR labeling
- Component management
- Maintainer notifications
- CI/CD workflow analysis ( ansible-test GitHub Actions )
- Status tracking
Node.js
>= 16- GitHub App credentials
- GitHub webhook secret
.env
file with proper configuration.github/BOTMETA.yml
file in the repository
- Clone the repository:
git clone https://github.com/3A2DEV/ANS2BOT.git
cd ANS2BOT
- Install dependencies:
npm install
- Create
.env
file with required configuration:
# GitHub App ID
APP_ID=your_app_id
# GitHub App private key
PRIVATE_KEY_PATH=path_to_private_key.pem
# The webhook secret
WEBHOOK_SECRET=your_webhook_secret
# Open Port
PORT=3000
# Log Level
LOG_LEVEL=debug
- Build and start the bot:
npm run build
npm start
ANS2BOT supports the following commands in issues and pull requests:
/label <label-name>
- Add a label to the issue/PR/unlabel <label-name>
- Remove a label from the issue/PR
/component <path>
- Specify or update the component path for an issue/PR
LGTM
or/lgtm
- Approve a pull request (requires proper authorization)
- Team Admins: Can approve any PR
- Component Maintainers: Can approve PRs that modify files they maintain
- Regular Contributors: Can comment but cannot approve PRs
The bot requires a .github/BOTMETA.yml
file in your repository with the following structure:
files:
path/to/component:
maintainers:
- username1
- username2
macros:
team_admin: adminUsername
The bot manages several types of labels:
needs_triage
- New issues/PRs requiring attentionneeds_review
- PRs ready for reviewneeds_revision
- PRs requiring changessuccess
- PRs passing all checks
plugin
- Plugin-related changes.module
- Module-related changes.docs
- Documentation changes.docsite
- Docsite Documentation changes.tests
- Test-related changes.integration
- Ansible-test integration changes.github
- .github changes.github_action
- .github/workflows changes.
bug
- Bug Report issues or PRs.feature
- Future request issues or PRs.documentation
- Documentation issues or PRs.testing
- Test PRs.new_plugin
- New Plugin PRs.new_module
- New Module PRs.refactor
- Refactoring PRs.
backport-10
- Backport toStable-10
for Patchback bot.
The bot automatically:
- Analyzes CI/CD workflow results ( ansible-test GitHub Actions )
- Posts detailed error reports for failed tests
- Updates PR labels based on test results
- Notifies relevant maintainers
The bot provides detailed error feedback for:
- Python test failures
- YAML parsing errors
- Ansible task failures
- Ansible Sanity, Units and Integration test issues
npm test
npm run lint
npm run dev
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and feature requests, please use the GitHub issue tracker.