summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Daenney <daenney@noreply.codeberg.org>2025-05-11 15:14:06 +0000
committerLibravatar Daenney <daenney@noreply.codeberg.org>2025-05-11 15:14:06 +0000
commitd3c67ad64230d5e23c9cca4483e5e5119deb5789 (patch)
tree5edc83f4ae512119e45764146954b9e03cbd1a49
parent[feature] Notify accounts when a status they've interacted with has been edit... (diff)
downloadgotosocial-d3c67ad64230d5e23c9cca4483e5e5119deb5789.tar.xz
[chore] Use Codeberg API for get_latest_snapshot (#4151)
# Description Switches the script to use the Codeberg API to retrieve the hash. ## Checklist Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]` If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want). - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [ ] I/we have performed a self-review of added code. - [ ] I/we have written code that is legible and maintainable by others. - [ ] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [ ] I/we have added tests that cover new code. - [ ] I/we have run tests and they pass locally with the changes. - [ ] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4151
-rwxr-xr-xscripts/get_latest_snapshot.sh21
1 files changed, 13 insertions, 8 deletions
diff --git a/scripts/get_latest_snapshot.sh b/scripts/get_latest_snapshot.sh
index 39cb54798..344810190 100755
--- a/scripts/get_latest_snapshot.sh
+++ b/scripts/get_latest_snapshot.sh
@@ -14,15 +14,20 @@ GTS_PLATFORM="linux"
GTS_ARCH="amd64"
GTS_FILENAME="gotosocial_${GTS_PLATFORM}_${GTS_ARCH}.tar.gz"
-GITHUB_API_HOST="api.github.com"
-GITHUB_ORG="superseriousbusiness"
-GITHUB_REPO="gotosocial"
-GITHUB_BRANCH="main"
-GITHUB_ENDPOINT="https://${GITHUB_API_HOST}/repos/${GITHUB_ORG}/${GITHUB_REPO}/commits/${GITHUB_BRANCH}"
+API_HOST="codeberg.org"
+ORG="superseriousbusiness"
+REPO="gotosocial"
+BRANCH="main"
-echo "fetching latest hash from endpoint '${GITHUB_ENDPOINT}'"
-LATEST_HASH="$(curl --silent --fail --retry 5 --retry-max-time 180 --max-time 30 "${GITHUB_ENDPOINT}" | jq -r .sha)"
-echo "got latest hash = ${LATEST_HASH}"
+ENDPOINT="https://${API_HOST}/api/v1/repos/${ORG}/${REPO}/git/refs/heads/${BRANCH}"
+
+if [ $# -ge 1 ] && [ -n "$1" ]; then
+ LATEST_HASH=$1
+else
+ echo "fetching latest hash from endpoint '${ENDPOINT}'"
+ LATEST_HASH="$(curl --silent --fail --retry 5 --retry-max-time 180 --max-time 30 "${ENDPOINT}" | jq -r 'first(.[]|.object.sha)')"
+ echo "got latest hash = ${LATEST_HASH}"
+fi
MINIO_HOST="s3.superseriousbusiness.org"
MINIO_BUCKET="gotosocial-snapshots"