-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull_request.py
27 lines (20 loc) · 1.01 KB
/
pull_request.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
import settings
import random
from github import Github
import tweepy
CONSUMER_KEY = settings.ENV['CONSUMER_KEY']
CONSUMER_SECRET = settings.ENV['CONSUMER_SECRET']
ACCESS_KEY = settings.ENV['ACCESS_KEY']
ACCESS_SECRET = settings.ENV['ACCESS_SECRET']
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
tweepy = tweepy.API(auth)
def get_pull_request():
greetings = ['Hi, ', 'Hello, ', 'Hey, ', 'Hi there, ', 'Hello there, ', 'Hey there, ']
subject = ['see my new post ', 'take a look to my new post ', 'read my new post ', 'see my new article ', 'read my new article ', 'take a look to my new article ']
preposition = ' in '
g = Github(settings.ENV['USER_GITHUB'], settings.ENV['PSWD_GITHUB'])
repo = g.get_repo(settings.ENV['REPO_GITHUB'])
pulls = repo.get_pulls(state='open', sort='created', base='master')
for pr in pulls:
tweepy.update_status(random.choice(greetings) + random.choice(subject) + pr.title + preposition + settings.ENV['URL'] + '.')