Add Gitea build, container tests and registry publication
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
All checks were successful
Build, test and publish / verify (push) Successful in 1m41s
This commit is contained in:
16
ci/main-head.py
Normal file
16
ci/main-head.py
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read the current main head without placing an access token in arguments/logs."""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
url = os.environ['GITEA_SERVER_URL'].rstrip('/') + '/api/v1/repos/' + os.environ['CI_REPOSITORY'] + '/branches/main'
|
||||
request = urllib.request.Request(url, headers={'Authorization': 'token ' + os.environ['REGISTRY_TOKEN']})
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
print(json.load(response)['commit']['id'])
|
||||
except (urllib.error.URLError, KeyError, ValueError) as error:
|
||||
print(f'Cannot verify current main head ({type(error).__name__})', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user