Github APIs allow use to get a check run by id: https://docs.github.com/en/rest/reference/checks#get-a-check-run / https://octokit.github.io/rest.js/v18#checks-get
This can be used to get the output
of a check run and then one can append it with new output using the Update method: https://docs.github.com/en/rest/reference/checks#update-a-check-run / https://octokit.github.io/rest.js/v18#checks-update
However if some other task has externally modified the check between the read and the write, that external modification will be lost.
Given that the GitHub api for checks (https://docs.github.com/en/rest/reference/checks) does not have an upsert method, is there a general approach that can be used to perform upserts for such APIs?
I keep thinking of some method of locks, but haven't found a satisfying answer or been able to come up with a solution myself.