-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
28 changed files
with
907 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
owners: | ||
- jwcesign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Fixes # | ||
|
||
<!-- Please include the 'why' behind your changes if no issue exists --> | ||
## Proposed Changes | ||
|
||
* | ||
* | ||
* | ||
|
||
**Release Note** | ||
|
||
<!-- Enter your extended release note in the below block. If the PR requires | ||
additional action from users switching to the new release, include the string | ||
"action required". If no release note is required, write "NONE". --> | ||
|
||
```release-note | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: GitAutomator image build and push | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: GitAutomator - build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
platforms: | | ||
linux/amd64 | ||
push: true | ||
tags: cesign/gitautomator:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: GitAutomator style check | ||
|
||
on: | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
pip install typing-extensions | ||
pip install -r requirements.txt | ||
- name: Analysing the code with pylint | ||
run: | | ||
ROOT=$(pwd) | ||
pylint $(git ls-files '*.py') --max-line-length=240 | ||
- name: MD link check | ||
uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
with: | ||
use-quiet-mode: "yes" | ||
config-file: ".mdlintrc" | ||
folder-path: "./" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: GitAutomator image build test | ||
|
||
on: | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set Up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build images | ||
run: | | ||
set -x | ||
docker buildx build --platform linux/amd64 -t cesign/gitautomator:latest -f Dockerfile --load ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[MASTER] | ||
disable= | ||
C0114, # missing-module-docstring | ||
C0115, # missing-class-docstring | ||
C0116, # missing-class-docstring | ||
W0703, # broad-except | ||
W0511, # fixme, like TODO | ||
R1732, # consider-using-with | ||
C0201, # consider-iterating-dictionary | ||
I1101, # Module 'libtorrent' has no 'torrent_info' member | ||
W0719, # Raising too general exception | ||
R0902, # Too many instance attributes | ||
R1714, # onsider merging these comparisons with 'in' | ||
R0903, # Too few public methods | ||
R0913, # Too many arguments | ||
R0911, # Too many return statements | ||
W4905, # Using deprecated decorator abc.abstractproperty() | ||
|
||
[SIMILARITIES] | ||
# Minimum lines number of a similarity. | ||
min-similarity-lines=100 | ||
|
||
# Ignore comments when computing similarities. | ||
ignore-comments=yes | ||
|
||
# Ignore docstrings when computing similarities. | ||
ignore-docstrings=yes | ||
|
||
# Ignore imports when computing similarities. | ||
ignore-imports=no | ||
|
||
[FORMAT] | ||
# Maximum number of characters on a single line. | ||
max-line-length=240 | ||
|
||
[BASIC] | ||
# Regular expression matching correct method names | ||
# Pylint do not complain for setUp and other if it | ||
# detects that we inherit from unittest.TestCase | ||
# But that's not always possible to detect. | ||
method-rgx=[a-z_][a-z0-9_]{2,30}$|do_POST(Class)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM python:3.10-alpine | ||
|
||
WORKDIR /app | ||
COPY ./bots ./bots | ||
COPY ./app.py ./ | ||
COPY requirements.txt ./ | ||
|
||
RUN set -ex \ | ||
&& apk add --no-cache git \ | ||
&& python3 -m pip install --upgrade pip \ | ||
&& pip install -r requirements.txt | ||
|
||
ENTRYPOINT [ "python", "app.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 jwcesign | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<div align="center"> | ||
<a href="https://github.com/apps/gitautomator"><img height="100px" alt="logo" src="./images/logo.png"></a> | ||
<p> | ||
<em>A smart automated GitHub bot for managing GitHub projects.</em> | ||
</p> | ||
<div> | ||
<a href="#"> | ||
<img src="https://img.shields.io/badge/python-3.11-blue" /> | ||
</a> | ||
<a href="https://github.com/jwcesign/gitautomator/blob/main/LICENSE"> | ||
<img src="https://img.shields.io/github/license/jwcesign/gitautomator" alt="License" /> | ||
</a> | ||
<a href="https://github.com/jwcesign/gitautomator/stargazers"> | ||
<img src="https://img.shields.io/github/stars/jwcesign/gitautomator?style=plastic" /> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
## ❤️ Introduction | ||
|
||
GitAutomator responds to various events in your repository, acting as a smart assistant to enhance maintenance efficiency. | ||
|
||
## 💾 Installation | ||
|
||
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. | ||
|
||
## ⛵ Plugins and Functions | ||
|
||
| Name | Description | | ||
| ---- | ----------- | | ||
| cat | To verify if GitAutomator functions properly with your repository, use the `/cat` command in an issue or PR | | ||
| ailabel | GitAutomator will utilize ChatGPT to label an issue or PR based on the labels in your repository and the issue/PR content | | ||
| aireleasenote | GitAutomator checks the release note block<sup>[1]</sup>, assesses its appropriateness, and provides notifications | | ||
| approve | GitAutomator will approve and merge a PR when the maintainer comments `/approve` | | ||
| cherrypick | GitAutomator will cherry-pick the commits of the PR to another `<target_branch>` when the maintainer comments `/cherry-pick <target_branch>` | | ||
| label | GitAutomator will add `<target_label>` to the PR or issue when an account comments `/label <target_label>` | | ||
| prcomment | GitAutomator will post a thank you comment when a new PR is submitted | | ||
| 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` | | ||
| prreact | GitAutomator will react with a heart when a new PR is submitted | | ||
| prreviewrequest | GitAutomator will automatically request reviews from the maintainers configured in `.github/gitautomator.yaml` | | ||
|
||
* **[1]**: The PR body should contain the following block: | ||
|
||
<img src="./images/release-note.png" width="400px"> | ||
|
||
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. | ||
|
||
## 📃 Configuration | ||
|
||
You can define the specific behavior by configuring the `.github/gitautomator.yaml` file in your repository. The complete configuration is as follows: | ||
```yaml | ||
owners: | ||
- jwcesign # This identifies the maintainer of this repository. GitAutomator will request reviews from them for any new PR. | ||
plugins: | ||
- cat # This identifies the plugins to enable. If left blank, all plugins will be enabled. | ||
``` | ||
## 🚀 Self Hosting Guide | ||
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. | ||
### Create GitHub App | ||
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. | ||
Repository permissions: | ||
* Commit statuses: Read and write | ||
* Contents: Read and write | ||
* Merge queues: Read and write | ||
* Metadata: Read-only | ||
* Pull requests: Read and write | ||
* Issues: Read and write | ||
In Subscribe to events select following events: | ||
* Commit comment | ||
* Issue comment | ||
* Issues | ||
* Label | ||
* Merge group | ||
* Merge queue entry | ||
* Pull request | ||
### Obtain App ID and Private Key | ||
After creating a GitHub App, download the private key as `app.pem` in the current directory and remember the App ID. | ||
|
||
### Create a Webhook Channel | ||
|
||
Visit [https://smee.io](https://smee.io) to create a new channel, and remember the webhook proxy URL. | ||
|
||
### Configure GitHub App Webhook URL | ||
|
||
Navigate to the GitHub App settings page, and fill the App's webhook URL field with the Smee webhook proxy URL. | ||
|
||
### Launch the Service | ||
|
||
1. Clone repository: | ||
```sh | ||
git clone https://github.com/jwcesign/gitautomator.git | ||
``` | ||
|
||
2. Export the necessary environment variables: | ||
```sh | ||
export APP_ID=xxx | ||
export SMEEIO_URL=xxx | ||
export CHATGPT_URL=https://api.openai.com/v1 # you can set another URL | ||
export OPENAI_KEY=xxx # your OpenAI secret key | ||
``` | ||
|
||
3. Run the container service: | ||
``` | ||
docker-compose up -d | ||
``` | ||
|
||
4. Enjoy your time! | ||
|
||
## 🤝 Contribution | ||
|
||
If you are interested in participating in joint development, welcome to STAR/FORK/PR. |
Oops, something went wrong.