-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_release.py
More file actions
52 lines (44 loc) · 1.02 KB
/
create_release.py
File metadata and controls
52 lines (44 loc) · 1.02 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
import os
import requests
from update import (
get_body,
get_tag_release
)
owner = 'moekernel'
repo = 'clang'
tag_name = get_tag_release()
target_commitish = 'main'
name = get_tag_release()
body = get_body()
draft = False
prerelease = False
token = os.getenv('TOKEN_GITHUB', '')
def draft_release():
url = f'https://api.github.com/repos/{owner}/{repo}/releases'
headers = {
'Authorization': f'token {token}',
'Accept': 'application/vnd.github.v3+json'
}
data = {
'tag_name': tag_name,
'target_commitish': target_commitish,
'name': name,
'body': body,
'draft': draft,
'prerelease': prerelease
}
response = requests.post(
url,
headers=headers,
data=json.dumps(data)
)
if response.status_code == 201:
print('New release created successfully!')
else:
print(
'Error creating release:',
response.status_code,
response.text
)
draft_release()