Skip to content

Commit

Permalink
test ci: include commit link in CI channel message
Browse files Browse the repository at this point in the history
  • Loading branch information
luvletter2333 committed Mar 6, 2023
1 parent ed4fdf2 commit 021af48
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/scripts/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def sendMessage(message, user_id = BOT_TARGET, entities = None) -> int:
return int(resp["result"]["message_id"])


def sendDocument(user_id, path, message = ""):
def sendDocument(user_id, path, message = "", entities = None):
files = {'document': open(path, 'rb')}
data = {'chat_id': user_id, 'caption': message, 'parse_mode': 'Markdown'}
data = {'chat_id': user_id,
'caption': message,
'parse_mode': 'Markdown',
'caption_entities': entities}
response = requests.post(API_PREFIX + "sendDocument", files=files, data=data)
print(response.json())

Expand Down Expand Up @@ -127,8 +130,10 @@ def sendCIRelease():
apks = os.listdir(APK_FOLDER)
apks.sort()
apk = os.path.join(APK_FOLDER, apks[0])
message = f"CI Build\n\n{COMMIT_MESSAGE}\n\n{COMMIT_HASH[0:8]}"
sendDocument(user_id=CI_CHANNEL_ID, path = apk, message=message)
entities = []
message = f"CI Build\n\n{COMMIT_MESSAGE}\n\n"
message += addEntity(entities, message, "text_link", COMMIT_HASH[0:8], f"https://github.com/NekoX-Dev/NekoX/commit/{COMMIT_HASH}")
sendDocument(user_id=CI_CHANNEL_ID, path = apk, message=message, )


if __name__ == '__main__':
Expand Down

0 comments on commit 021af48

Please sign in to comment.