-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (29 loc) Β· 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from datetime import datetime
from pytz import timezone
from github import Github
import requests
def get_event():
API_PATH = os.environ['REAL_API']
response = requests.get(API_PATH)
if response.status_code != 200:
return ""
return response.text
if __name__ == "__main__":
access_token = os.environ['MY_GITHUB_TOKEN']
repository_name = "Dev-Event-Subscribe"
seoul_timezone = timezone('Asia/Seoul')
today = datetime.now(seoul_timezone)
now_month = int(today.strftime('%m'))
now_day = int(today.strftime('%d'))
week = int(now_day/7) + 1
today_int = int(today.strftime('%m%d'))
title = f"μ£Όκ° Dev Event - {now_month}μ {week}μ§Έμ£Ό κ°λ°μ νμ¬"
content = get_event()
if content != "":
# repoμ μ κ·Ό
g = Github(access_token)
repo = g.get_organization("brave-people").get_repo(repository_name)
# μ΄μ μμ±
repo.create_issue(title=title, body=content)
print("issue λ±λ‘ μλ£")