Skip to content

Commit 027400a

Browse files
🩹 fix(GitHub): Use dedicated PAT to handle notifications.
1 parent d70637f commit 027400a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.bin/github.mark_as_read

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if len(sys.argv) < 2: sys.exit(1)
1212

1313
thread_id = sys.argv[1]
1414

15-
token = github.token()
15+
token = github.token('/notifications')
1616
url = github.api('/notifications/threads/{thread_id}', thread_id=thread_id)
1717

1818
github.patch(url, token=token)

.bin/github.notifications

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import sys
99
import json
1010
import github
1111

12-
token = github.token()
12+
token = github.token('/notifications')
1313
first_page = github.api('/notifications?per_page=100')
1414

1515
for page in github.pages(first_page, token=token):

.bin/github.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def api ( endpoint, *args, **kwargs ) :
6868
github_api = 'https://api.github.com'
6969
return github_api + endpoint.format(*args, **kwargs)
7070

71-
def token ( ) :
72-
p = subprocess.run(['pass', 'apps/github/pat'], stdout=subprocess.PIPE)
71+
def token ( kind = '') :
72+
p = subprocess.run(['pass', 'apps/github/pat{}'.format(kind)], stdout=subprocess.PIPE)
7373
if p.returncode == 0 :
7474
return p.stdout.decode('utf-8')[:-1]
7575
else:

0 commit comments

Comments
 (0)