summaryrefslogtreecommitdiff
path: root/neozip/arch/s390/self-hosted-builder/actions-runner
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 19:56:09 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 19:56:09 +0300
commit7fb132859fda54aa96bc9dd46d302b343eeb5a02 (patch)
treeb43ae77d7451fb470a260c03349a1caf2846c5e5 /neozip/arch/s390/self-hosted-builder/actions-runner
parentb1e34e861b5d732afe828d58aad2c638135061fd (diff)
parentc2712b8a345191f6ed79558c089777df94590087 (diff)
downloadProject-Tick-7fb132859fda54aa96bc9dd46d302b343eeb5a02.tar.gz
Project-Tick-7fb132859fda54aa96bc9dd46d302b343eeb5a02.zip
Add 'neozip/' from commit 'c2712b8a345191f6ed79558c089777df94590087'
git-subtree-dir: neozip git-subtree-mainline: b1e34e861b5d732afe828d58aad2c638135061fd git-subtree-split: c2712b8a345191f6ed79558c089777df94590087
Diffstat (limited to 'neozip/arch/s390/self-hosted-builder/actions-runner')
-rwxr-xr-xneozip/arch/s390/self-hosted-builder/actions-runner62
1 files changed, 62 insertions, 0 deletions
diff --git a/neozip/arch/s390/self-hosted-builder/actions-runner b/neozip/arch/s390/self-hosted-builder/actions-runner
new file mode 100755
index 0000000000..aabc802547
--- /dev/null
+++ b/neozip/arch/s390/self-hosted-builder/actions-runner
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+#
+# Ephemeral runner startup script.
+#
+# Expects the following environment variables:
+#
+# - REPO=<owner>
+# - PAT_TOKEN=<github_pat_***>
+#
+
+set -e -u
+
+# Validate required environment variables
+if [ -z "${REPO:-}" ] || [ -z "${PAT_TOKEN:-}" ]; then
+ echo "Error: REPO and/or PAT_TOKEN environment variables not found"
+ exit 1
+fi
+
+# Check the cached registration token.
+TOKEN_FILE=registration-token.json
+if [ -f $TOKEN_FILE ]; then
+ set +e
+ EXPIRES=$(jq --raw-output .expires_at "$TOKEN_FILE" 2>/dev/null)
+ STATUS=$?
+ set -e
+else
+ STATUS=1
+ EXPIRES=""
+fi
+
+if [[ $STATUS -ne 0 || -z "$EXPIRES" || "$EXPIRES" == "null" || $(date +%s) -ge $(date -d "$EXPIRES" +%s) ]]; then
+ # Refresh the cached registration token.
+ curl \
+ -sS \
+ -X POST \
+ -H "Accept: application/vnd.github+json" \
+ -H "Authorization: Bearer $PAT_TOKEN" \
+ "https://api.github.com/repos/$REPO/actions/runners/registration-token" \
+ -o "$TOKEN_FILE"
+fi
+
+REG_TOKEN=$(jq --raw-output .token "$TOKEN_FILE")
+if [ $REG_TOKEN = "null" ]; then
+ echo "Failed to get registration token"
+ exit 1
+fi
+
+# (Re-)register the runner.
+./config.sh remove --token "$REG_TOKEN" || true
+set -x
+./config.sh \
+ --url "https://github.com/$REPO" \
+ --token "$REG_TOKEN" \
+ --unattended \
+ --disableupdate \
+ --replace \
+ --labels z15 \
+ --ephemeral
+
+# Run one job.
+./run.sh