|
| 1 | +<div align="center"> |
| 2 | + <a href="https://github.com/apps/gitautomator"><img height="100px" alt="logo" src="./images/logo.png"></a> |
| 3 | + <p> |
| 4 | + <em>A smart automated GitHub bot for managing GitHub projects.</em> |
| 5 | + </p> |
| 6 | + <div> |
| 7 | + <a href="#"> |
| 8 | + <img src="https://img.shields.io/badge/python-3.11-blue" /> |
| 9 | + </a> |
| 10 | + <a href="https://github.com/jwcesign/gitautomator/blob/main/LICENSE"> |
| 11 | + <img src="https://img.shields.io/github/license/jwcesign/gitautomator" alt="License" /> |
| 12 | + </a> |
| 13 | + <a href="https://github.com/jwcesign/gitautomator/stargazers"> |
| 14 | + <img src="https://img.shields.io/github/stars/jwcesign/gitautomator?style=plastic" /> |
| 15 | + </a> |
| 16 | + </div> |
| 17 | +</div> |
| 18 | + |
| 19 | +## ❤️ Introduction |
| 20 | + |
| 21 | +GitAutomator responds to various events in your repository, acting as a smart assistant to enhance maintenance efficiency. |
| 22 | + |
| 23 | +## 💾 Installation |
| 24 | + |
| 25 | +Visit the relevant [GitHub APP](https://github.com/apps/gitautomator) page to install GitAutomator. After installation, comment `/cat` on an issue or PR to check its functionality. |
| 26 | + |
| 27 | +## ⛵ Plugins and Functions |
| 28 | + |
| 29 | +| Name | Description | |
| 30 | +| ---- | ----------- | |
| 31 | +| cat | To verify if GitAutomator functions properly with your repository, use the `/cat` command in an issue or PR | |
| 32 | +| ailabel | GitAutomator will utilize ChatGPT to label an issue or PR based on the labels in your repository and the issue/PR content | |
| 33 | +| aireleasenote | GitAutomator checks the release note block<sup>[1]</sup>, assesses its appropriateness, and provides notifications | |
| 34 | +| approve | GitAutomator will approve and merge a PR when the maintainer comments `/approve` | |
| 35 | +| cherrypick | GitAutomator will cherry-pick the commits of the PR to another `<target_branch>` when the maintainer comments `/cherry-pick <target_branch>` | |
| 36 | +| label | GitAutomator will add `<target_label>` to the PR or issue when an account comments `/label <target_label>` | |
| 37 | +| prcomment | GitAutomator will post a thank you comment when a new PR is submitted | |
| 38 | +| prlabel | GitAutomator will label a PR based on its title; it will label a title prefixed with `fix` as `bug`, `doc` as `documentation`, and `feat` as `enhancement` | |
| 39 | +| prreact | GitAutomator will react with a heart when a new PR is submitted | |
| 40 | +| prreviewrequest | GitAutomator will automatically request reviews from the maintainers configured in `.github/gitautomator.yaml` | |
| 41 | + |
| 42 | +* **[1]**: The PR body should contain the following block: |
| 43 | + |
| 44 | + <img src="./images/release-note.png" width="400px"> |
| 45 | + |
| 46 | + This could work excellently if you're looking to automatically generate polished release notes. Feel free to use this [template](./.github/pull-request-template.md) for your PR. |
| 47 | + |
| 48 | +## 📃 Configuration |
| 49 | + |
| 50 | +You can define the specific behavior by configuring the `.github/gitautomator.yaml` file in your repository. The complete configuration is as follows: |
| 51 | +```yaml |
| 52 | +owners: |
| 53 | +- jwcesign # This identifies the maintainer of this repository. GitAutomator will request reviews from them for any new PR. |
| 54 | +plugins: |
| 55 | +- cat # This identifies the plugins to enable. If left blank, all plugins will be enabled. |
| 56 | +``` |
| 57 | +
|
| 58 | +## 🚀 Self Hosting Guide |
| 59 | +
|
| 60 | +Use the official GitHub App to manage your code repository. You can also deploy this App on a self-hosted server. Here are the detailed instructions. |
| 61 | +
|
| 62 | +### Create GitHub App |
| 63 | +
|
| 64 | +First, you need to create a GitHub app. GitHub itself [documents this](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app). Below is the set of permissions needed. |
| 65 | +
|
| 66 | +Repository permissions: |
| 67 | +
|
| 68 | +* Commit statuses: Read and write |
| 69 | +* Contents: Read and write |
| 70 | +* Merge queues: Read and write |
| 71 | +* Metadata: Read-only |
| 72 | +* Pull requests: Read and write |
| 73 | +* Issues: Read and write |
| 74 | +
|
| 75 | +In Subscribe to events select following events: |
| 76 | +* Commit comment |
| 77 | +* Issue comment |
| 78 | +* Issues |
| 79 | +* Label |
| 80 | +* Merge group |
| 81 | +* Merge queue entry |
| 82 | +* Pull request |
| 83 | +
|
| 84 | +### Obtain App ID and Private Key |
| 85 | +
|
| 86 | +After creating a GitHub App, download the private key as `app.pem` in the current directory and remember the App ID. |
| 87 | + |
| 88 | +### Create a Webhook Channel |
| 89 | + |
| 90 | +Visit [https://smee.io](https://smee.io) to create a new channel, and remember the webhook proxy URL. |
| 91 | + |
| 92 | +### Configure GitHub App Webhook URL |
| 93 | + |
| 94 | +Navigate to the GitHub App settings page, and fill the App's webhook URL field with the Smee webhook proxy URL. |
| 95 | + |
| 96 | +### Launch the Service |
| 97 | + |
| 98 | +1. Clone repository: |
| 99 | +```sh |
| 100 | +git clone https://github.com/jwcesign/gitautomator.git |
| 101 | +``` |
| 102 | + |
| 103 | +2. Export the necessary environment variables: |
| 104 | +```sh |
| 105 | +export APP_ID=xxx |
| 106 | +export SMEEIO_URL=xxx |
| 107 | +export CHATGPT_URL=https://api.openai.com/v1 # you can set another URL |
| 108 | +export OPENAI_KEY=xxx # your OpenAI secret key |
| 109 | +``` |
| 110 | + |
| 111 | +3. Run the container service: |
| 112 | +``` |
| 113 | +docker-compose up -d |
| 114 | +``` |
| 115 | + |
| 116 | +4. Enjoy your time! |
| 117 | + |
| 118 | +## 🤝 Contribution |
| 119 | + |
| 120 | +If you are interested in participating in joint development, welcome to STAR/FORK/PR. |
0 commit comments