-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Release Notes - Fix attachment sending via Telegram interfaces (81673b5) - Fix PollingTelegramInterface dropping whenever an error occurred while responding (ec19921) - Fix `Pipeline._run_pipeline` failing when `ctx_id=None` (5c22cc7) - Docker improvements (#279) - Various tutorial improvements - Add release checklist
- Loading branch information
Showing
18 changed files
with
204 additions
and
92 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
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,81 @@ | ||
# flake8: noqa | ||
import os | ||
import json | ||
import requests | ||
|
||
GITHUB_ARGS = { | ||
"GITHUB_TOKEN": None, | ||
"GITHUB_REPOSITORY": None, | ||
"GITHUB_EVENT_PATH": None, | ||
"GITHUB_EVENT_NAME": None, | ||
} | ||
|
||
for arg in GITHUB_ARGS: | ||
GITHUB_ARGS[arg] = os.getenv(arg) | ||
|
||
if GITHUB_ARGS[arg] is None: | ||
raise RuntimeError(f"`{arg}` is not set") | ||
|
||
|
||
def post_comment_on_pr(comment: str, pr_number: int): | ||
""" | ||
Leave a comment as `github-actions` bot on a PR. | ||
""" | ||
headers = { | ||
"Accept": "application/vnd.github+json", | ||
"Authorization": f'Bearer {GITHUB_ARGS["GITHUB_TOKEN"]}', | ||
"X-GitHub-Api-Version": "2022-11-28", | ||
} | ||
|
||
escaped_comment = comment.replace("\n", "\\n") | ||
|
||
data = f'{{"body": "{escaped_comment}","event": "COMMENT","comments": []}}' | ||
|
||
response = requests.post( | ||
f'https://api.github.com/repos/{GITHUB_ARGS["GITHUB_REPOSITORY"]}/pulls/{pr_number}/reviews', | ||
headers=headers, | ||
data=data, | ||
) | ||
|
||
if not response.status_code == 200: | ||
raise RuntimeError(response.__dict__) | ||
|
||
|
||
RELEASE_CHECKLIST = """It appears this PR is a release PR (change its base from `master` if that is not the case). | ||
Here's a release checklist: | ||
- [ ] Update package version | ||
- [ ] Change PR merge option | ||
- [ ] Test modules without automated testing: | ||
- [ ] Requiring telegram `api_id` and `api_hash` | ||
- [ ] Requiring `HF_API_KEY` | ||
- [ ] Search for objects to be deprecated | ||
""" | ||
|
||
|
||
def post_release_checklist(pr_payload: dict): | ||
pr_number = pr_payload["number"] | ||
pr_base = pr_payload["base"] | ||
|
||
if pr_base["ref"] == "master": | ||
print("post_release_checklist") | ||
post_comment_on_pr(RELEASE_CHECKLIST, pr_number) | ||
|
||
|
||
def on_opened_pull_request(event_info: dict): | ||
print("on_opened_pull_request") | ||
|
||
post_release_checklist(event_info["pull_request"]) | ||
|
||
|
||
def main(): | ||
with open(GITHUB_ARGS["GITHUB_EVENT_PATH"], "r", encoding="utf-8") as fd: | ||
event_info = json.load(fd) | ||
print(f"event info: {event_info}") | ||
if GITHUB_ARGS["GITHUB_EVENT_NAME"] == "pull_request_target" and event_info["action"] == "opened": | ||
on_opened_pull_request(event_info) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,28 @@ | ||
on: | ||
pull_request_target: | ||
types: [ opened ] | ||
|
||
jobs: | ||
event_handler: | ||
strategy: | ||
fail-fast: false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: install dependencies | ||
run: python -m pip install requests | ||
shell: bash | ||
|
||
- name: handle event | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: python .github/process_github_events.py | ||
shell: bash |
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
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
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
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
__author__ = "Denis Kuznetsov" | ||
__email__ = "[email protected]" | ||
__version__ = "0.6.3" | ||
__version__ = "0.6.4" | ||
|
||
|
||
import nest_asyncio | ||
|
Oops, something went wrong.