CI script to report checks to forgejo
This commit is contained in:
parent
45a78e44b4
commit
54d97e55d9
2 changed files with 9 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
fleetFlake,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -24,6 +25,7 @@ let
|
||||||
curl
|
curl
|
||||||
tea
|
tea
|
||||||
attic-client
|
attic-client
|
||||||
|
fleetFlake.packages.${pkgs.system}.forgejo-report-checks
|
||||||
]
|
]
|
||||||
}; do
|
}; do
|
||||||
for bin in "$dir"/bin/*; do
|
for bin in "$dir"/bin/*; do
|
||||||
|
|
|
@ -6,16 +6,17 @@ from os import environ
|
||||||
|
|
||||||
client = AuthenticatedClient(base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"])
|
client = AuthenticatedClient(base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"])
|
||||||
|
|
||||||
print("hello")
|
|
||||||
|
|
||||||
with open('result.json', 'r') as file:
|
with open('result.json', 'r') as file:
|
||||||
data = json.load(file)
|
data = json.load(file)
|
||||||
|
|
||||||
|
print("Reporting statuses acording to the following result.json")
|
||||||
|
print(json.dumps(data, indent=2))
|
||||||
|
|
||||||
for result in data['results']:
|
for result in data['results']:
|
||||||
attr = result['attr']
|
attr = result['attr']
|
||||||
success = result['success']
|
success = result['success']
|
||||||
type = result['type']
|
type = result['type']
|
||||||
print(attr)
|
print(f"Report status success={success} for {type} {attr}")
|
||||||
response = repo_create_status.sync_detailed(
|
response = repo_create_status.sync_detailed(
|
||||||
owner="aciceri",
|
owner="aciceri",
|
||||||
repo="nixfleet",
|
repo="nixfleet",
|
||||||
|
@ -24,7 +25,9 @@ for result in data['results']:
|
||||||
body=CreateStatusOption(
|
body=CreateStatusOption(
|
||||||
context=type,
|
context=type,
|
||||||
description=attr,
|
description=attr,
|
||||||
target_url="https://google.com",
|
target_url="https://git.aciceri.dev", # FIXME
|
||||||
state="success" if success else "failure" # ma be pending,success,failure,error_message
|
state="success" if success else "failure" # ma be pending,success,failure,error_message
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print("Done reporting statuses")
|
||||||
|
|
Loading…
Add table
Reference in a new issue