-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (25 loc) · 741 Bytes
/
main.py
File metadata and controls
35 lines (25 loc) · 741 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
30
31
32
33
34
35
import os
import github
def write_outputs(outputs: dict):
with open(os.getenv("GITHUB_OUTPUT"), "a") as f:
for key, value in outputs.items():
f.write(f"${key}={value}\n")
def main():
organization = os.getenv("GITHUB_ORG")
repository = os.getenv("GITHUB_REPO")
token = os.getenv("GH_TOKEN")
workflow_id = os.getenv("GITHUB_WORKFLOW_ID")
git_reference = os.getenv("GIT_REFERENCE")
auth = github.Auth(
token,
organization,
repository,
)
workflow = github.Workflow(auth)
conclusion = workflow.invoke(
ref=git_reference,
workflow_id=workflow_id,
)
write_outputs({"conclusion": conclusion})
if __name__ == "__main__":
main()