-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (20 loc) · 684 Bytes
/
main.py
File metadata and controls
29 lines (20 loc) · 684 Bytes
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
import os
from pathlib import Path
from github import Github
def main():
about = {}
with Path(os.environ["INPUT_PATH"]).open() as f:
exec(f.read(), about)
prefix = os.environ["INPUT_PREFIX"]
variable = os.environ["INPUT_VARIABLE"]
suffix = os.environ["INPUT_SUFFIX"]
version_tag = f"{prefix}{about[variable]}{suffix}"
g = Github(os.environ["INPUT_GITHUB_TOKEN"])
repo = g.get_repo(os.environ["github"]["repository"])
for tag in repo.get_tags():
if tag.name == version_tag:
return
sha = repo.get_commits()[0].sha
repo.create_git_ref(f"refs/tags/{version_tag}", sha)
if __name__ == "__main__":
main()