chore(celebration): also celebrate on multiple of 5k (#5414)

32768 太远了(
pull/5415/head
Yufan You 2024-02-16 21:58:31 +08:00 committed by GitHub
parent 86dd0a85dc
commit 93bd1b95ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,12 @@ import requests
import json
import sys
from datetime import datetime
from math import log2
def nextCelebration(current):
a = (current // 5000 + 1) * 5000
b = 2 ** (int(log2(current)) + 1)
return min(a, b)
headers = {
"Authorization": f'token {sys.argv[1]}'
@ -66,7 +72,7 @@ mutation {{
mut = requests.post('https://api.github.com/graphql', json.dumps({ 'query': mutation }), headers = headers)
print(mut.text)
celebration = maxCelebration * 2
celebration = nextCelebration(maxCelebration)
if stars >= celebration - 1: # "will soon" reach
mutation = f'''
@ -90,7 +96,7 @@ mutation {{
非常感谢这么长时间以来大家的支持我们再接再厉
最后祝大家身体健康我们 {celebration * 2} stars 时再见
最后祝大家身体健康我们 {nextCelebration(celebration)} stars 时再见
cc {" ".join(numbers)}
""", ensure_ascii = False)}