-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update the bot and refactor files #6
Conversation
Changes in detail: 1. Switch to Python 3. 2. Rename `post_comment.py` to `tldr_bot.py`. 3. Change main endpoint from `/` to `/comment` (old one is still kept for compatibility, will be removed once we update the travis scripts on the pages repo). 4. Add new endpoint `/comment/once` which does the same as `/comment`, but first checks if `tldr-bot` hasn't already commented on the PR. 5. Rename the `/test` endpoint to `/status`. 6. Change HTTP response code for malformed request from 500 (server error) to 400 (client error). 7. Remove the unneeded `GITHUB_URL` environment variable. 8. Refactor code (reorder imports, indentation, spacing, etc.)
Changes in detail: 1. Change script name to `tldr_bot.py`. 2. Remove unneeded `GITHUB_URL` and `APP_ROOT` environment variables. 3. Overall refactor: wording, formatting, etc.
Changes in detail: 1. Change script name to `tldr_bot.py`. 2. Add `Wants=` and `After=` directives to start the service after the network is online. 3. Add recommended `User=` and `Group=` directives to run the as a specific user different than `root`. 4. Reorder fields in order of importance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @mebeim ! I have some comments to improve this further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @mebeim. Thanks !
@tldr-bot is now running the latest code from this branch. |
Let's merge this ! |
So... not really a big change, just a bunch of little changes.
The main point of this PR is to update the bot to add a new endpoint that checks if a comment was already made on the PR before posting a new one. This will be helpful when adding the checking functionality in the main repo which checks if pages of a PR are already present or duplicated. To notify the author, the bot needs to comment only once when the PR is created, not every single time a commit is pushed to the PR (that functionality is still there of course since it's needed for build errors, just on a different endpoint).
Detailed list of changes (also available in the commit messages):
Changes to the Python script:
post_comment.py
totldr_bot.py
./
to/comment
(old one is still kept for compatibility, will be removed once we update the travis scripts on the pages repo)./comment/once
which does the same as/comment
, but first checks iftldr-bot
hasn't already commented on the PR./test
endpoint to/status
.GITHUB_URL
environment variable.Changes to the systemd
.service
file:tldr_bot.py
.Wants=
andAfter=
directives to start the service after the network is online.User=
andGroup=
directives to run as a specific user different thanroot
.Changes to
README.md
:tldr_bot.py
.GITHUB_URL
andAPP_ROOT
environment variables.PS: I have no Idea why GitHub is using lowercase Roman numerals for the secodnary list elements, LOL. Hope it's still clear.