mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
Check if the HEAD commit is publicly available on GitHub. If it is, set it in the database (#95043)
## About The Pull Request TGS provides two SHA's to the game. The first is the closest commit on the tracked branch (`master`) the second is the true revision of the game. The latter may be equal to the first, but not when test merges are active. We normally set the database `commit_hash` to the first because we can't guarantee the latter is on GitHub. TGS **does** try to push it there however (i.e. https://github.com/tgstation/tgstation/commit/b7c18d2bdb6b091255716fa801113be4d73be987) provided it has proper credentials. This PR will ping the HEAD SHA on GitHub to see if it exists there. If it does, it'll be set as the round's `commit_hash`. ## Why It's Good For The Game Allows statbus to link to the EXACT commit of the round which includes test merges. Currently it lies when test merges are active by linking the `master` commit. ## Changelog 🆑 server: If TGS is configured to push test merge commits to a publicly accessible GitHub, the exact game revision will be set as the `round`.`commit_hash` in the database. /🆑 @nfreader --------- Co-authored-by: Jordan Dominion <Cyberboss@users.noreply.github.com>
This commit is contained in:
co-authored by
Jordan Dominion
parent
f764992877
commit
193023cc3c
@@ -41,6 +41,26 @@
|
||||
|
||||
return msg.Join("\n")
|
||||
|
||||
/datum/getrev/proc/GetDatabaseCommitSha()
|
||||
. = originmastercommit
|
||||
if (commit == .)
|
||||
return .
|
||||
|
||||
var/gh_url = CONFIG_GET(string/githuburl)
|
||||
if(!gh_url)
|
||||
return .
|
||||
|
||||
var/datum/http_request/request = new()
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[gh_url]/commit/[commit]", "", "")
|
||||
request.begin_async()
|
||||
UNTIL(request.is_complete())
|
||||
var/datum/http_response/response = request.into_response()
|
||||
|
||||
if (response.status_code >= 200 && response.status_code < 300)
|
||||
return commit
|
||||
|
||||
return .
|
||||
|
||||
/datum/getrev/proc/GetTestMergeInfo(header = TRUE)
|
||||
if(!testmerge.len)
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user