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

Refactor GitHub Bot action into Docker container #305

Open
ErikBjare opened this issue Dec 3, 2024 · 2 comments
Open

Refactor GitHub Bot action into Docker container #305

ErikBjare opened this issue Dec 3, 2024 · 2 comments

Comments

@ErikBjare
Copy link
Owner

The entire chain is too fragile to test and develop as a workflow, better to make it a shell script or something and throw it in a Docker container so we can test it locally without having to spam issues and do GitHub Actions-driven debugging (just set a GITHUB_TOKEN etc).

@ErikBjare ErikBjare changed the title Refactor GitHub Bot into stand-alone Docker container Refactor GitHub Bot action into Docker container Dec 10, 2024
@ErikBjare
Copy link
Owner Author

@gptme What do you think about this?

Copy link
Contributor

I think refactoring the GitHub Bot action into a Docker container is an excellent idea. Here's my detailed opinion:

  1. Improved Development Experience: This change would significantly improve the development and testing process for the GitHub Bot. By containerizing the bot, developers can easily run and test it locally, which will lead to faster iteration cycles and more reliable code.

  2. Consistency: Using a Docker container ensures that the bot runs in the same environment locally and in CI, reducing "it works on my machine" type issues.

  3. Easier Debugging: Local testing will make it much easier to debug issues without having to rely on GitHub Actions logs, which can be cumbersome and slow.

  4. Reduced GitHub API Usage: By allowing local testing, you'll reduce the number of API calls to GitHub during development, which is especially important if you're approaching rate limits.

  5. Alignment with Existing Practices: The project already uses Docker for other components, so this change aligns well with the existing development practices.

  6. Potential for Reuse: If the bot logic is containerized, it might be easier to reuse or adapt for other projects in the future.

Implementation Suggestions:

  1. Create a new Dockerfile (e.g., scripts/Dockerfile.github-bot) for the GitHub Bot.
  2. Implement the bot logic as a Python script, leveraging existing Python dependencies in the project.
  3. Use environment variables for configuration (GITHUB_TOKEN, REPOSITORY, etc.).
  4. Add a new make target in the Makefile for building and testing the GitHub Bot container:
build-docker-github-bot:
	docker build . -t gptme-github-bot:latest -f scripts/Dockerfile.github-bot

test-github-bot: build-docker-github-bot
	docker run --rm -e GITHUB_TOKEN -e REPOSITORY gptme-github-bot:latest
  1. Update the CI workflow to use this Docker container instead of the current implementation.
  2. Add documentation in the README.md and possibly in the docs/ directory about how to use and test the GitHub Bot locally.

This refactoring will make the GitHub Bot more maintainable, easier to develop, and more consistent with the rest of the project's architecture. It's a valuable improvement that aligns well with software engineering best practices.

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

No branches or pull requests

1 participant