From c666f0228d4d0ba3cc958cf176ce99b075c29224 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 14:54:31 +0200 Subject: [PATCH 01/10] Test Backporting Signed-off-by: Chaoscaot --- .gitea/workflows/backport-commoncore.yml | 81 ++++++++++++++++++------ 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/backport-commoncore.yml b/.gitea/workflows/backport-commoncore.yml index 88f2a54f..d53848ad 100644 --- a/.gitea/workflows/backport-commoncore.yml +++ b/.gitea/workflows/backport-commoncore.yml @@ -36,9 +36,17 @@ jobs: api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}" + echo "Backport debug: event=${GITHUB_EVENT_NAME:-unknown}" + echo "Backport debug: server=${GITHUB_SERVER_URL}" + echo "Backport debug: api=${api_url}" + echo "Backport debug: repository=${GITHUB_REPOSITORY}" + echo "Backport debug: action=$(jq -r '.action // ""' "$GITHUB_EVENT_PATH")" + merged="$(jq -r '.pull_request.merged // (.pull_request.merged_at != null)' "$GITHUB_EVENT_PATH")" base_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")" has_disable_label="$(jq -r --arg disable_backport_label "$DISABLE_BACKPORT_LABEL" 'any(.pull_request.labels[]?; .name == $disable_backport_label)' "$GITHUB_EVENT_PATH")" + echo "Backport debug: pr=$(jq -r '.pull_request.number // ""' "$GITHUB_EVENT_PATH") base=${base_branch} merged=${merged}" + echo "Backport debug: disable label present=${has_disable_label}" { echo "should_backport=$([[ "$merged" == "true" && "$base_branch" == "main" && "$has_disable_label" != "true" ]] && echo true || echo false)" @@ -73,6 +81,44 @@ jobs: set -euo pipefail api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}" + repo_api_path="/repos/${GITHUB_REPOSITORY}" + + api_request() { + local method="$1" + local path="$2" + local output="$3" + local data_file="${4:-}" + local status + local args=(-sS -X "$method" -H "Accept: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -w "%{http_code}" -o "$output") + + if [[ -n "$data_file" ]]; then + args+=(-H "Content-Type: application/json" --data-binary "@${data_file}") + fi + + echo "Backport debug: ${method} ${path}" + if ! status="$(curl "${args[@]}" "${api_url}${path}")"; then + echo "Backport debug: ${method} ${path} failed before HTTP status was captured." + if [[ -s "$output" ]]; then + echo "Backport debug: response body:" + cat "$output" + fi + return 1 + fi + + echo "Backport debug: ${method} ${path} -> HTTP ${status}" + if [[ ! "$status" =~ ^2 ]]; then + echo "Backport debug: response body:" + cat "$output" + return 1 + fi + } + + echo "Backport debug: event=${GITHUB_EVENT_NAME:-unknown}" + echo "Backport debug: server=${GITHUB_SERVER_URL}" + echo "Backport debug: api=${api_url}" + echo "Backport debug: repository=${GITHUB_REPOSITORY}" + echo "Backport debug: pr=${PR_NUMBER}" + echo "Backport debug: actor=${GITHUB_ACTOR:-unknown}" git config user.name "SteamWar Backport Bot" git config user.email "actions@steamwar.de" @@ -84,10 +130,14 @@ jobs: git fetch --prune origin '+refs/heads/version/*:refs/remotes/origin/version/*' - curl -fsSL \ + api_request GET "${repo_api_path}" repo-debug.json + jq -r '"Backport debug: repo permissions admin=\(.permissions.admin // "unknown") push=\(.permissions.push // "unknown") pull=\(.permissions.pull // "unknown")"' repo-debug.json || true + + echo "Backport debug: GET ${repo_api_path}/pulls/${PR_NUMBER}.diff" + curl -fsSL -w "Backport debug: GET ${repo_api_path}/pulls/${PR_NUMBER}.diff -> HTTP %{http_code}\n" \ -H "Accept: text/plain" \ -H "Authorization: token ${GITHUB_TOKEN}" \ - "${api_url}/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}.diff" \ + "${api_url}${repo_api_path}/pulls/${PR_NUMBER}.diff" \ -o pull-request.diff if ! grep -Eq "^diff --git a/${BACKPORT_PATH}/" pull-request.diff; then @@ -121,11 +171,8 @@ jobs: git commit -m "Backport CommonCore changes from #${PR_NUMBER}" -m "${PR_TITLE}" git push --force-with-lease origin "${backport_branch}" - open_pr_number="$(curl -fsS \ - -H "Accept: application/json" \ - -H "Authorization: token ${GITHUB_TOKEN}" \ - "${api_url}/repos/${GITHUB_REPOSITORY}/pulls?state=open" \ - | jq -r --arg base "$target_branch" --arg head "$backport_branch" '[.[] | select(.base.ref == $base and .head.ref == $head) | (.number // .index)][0] // empty')" + api_request GET "${repo_api_path}/pulls?state=open" open-pulls.json + open_pr_number="$(jq -r --arg base "$target_branch" --arg head "$backport_branch" '[.[] | select(.base.ref == $base and .head.ref == $head) | (.number // .index)][0] // empty' open-pulls.json)" if [[ -n "$open_pr_number" ]]; then echo "Backport PR #${open_pr_number} already exists for ${target_branch}." @@ -134,15 +181,13 @@ jobs: pr_body="$(printf 'Automatic CommonCore backport of #%s.\n\nOriginal PR title: %s\n\nOnly files below `CommonCore/` are included.' "$PR_NUMBER" "$PR_TITLE")" - curl -fsS -X POST \ - -H "Accept: application/json" \ - -H "Authorization: token ${GITHUB_TOKEN}" \ - -H "Content-Type: application/json" \ - -d "$(jq -n \ - --arg base "$target_branch" \ - --arg head "$backport_branch" \ - --arg title "Backport CommonCore changes from #${PR_NUMBER} to ${target_branch}" \ - --arg body "$pr_body" \ - '{base: $base, head: $head, title: $title, body: $body}')" \ - "${api_url}/repos/${GITHUB_REPOSITORY}/pulls" + jq -n \ + --arg base "$target_branch" \ + --arg head "$backport_branch" \ + --arg title "Backport CommonCore changes from #${PR_NUMBER} to ${target_branch}" \ + --arg body "$pr_body" \ + '{base: $base, head: $head, title: $title, body: $body}' > create-pull.json + + echo "Backport debug: create PR base=${target_branch} head=${backport_branch}" + api_request POST "${repo_api_path}/pulls" create-pull-response.json create-pull.json done From 236b486845687ca173cffd39122729ae171c1eae Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 14:55:13 +0200 Subject: [PATCH 02/10] Test Backporting Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt index 841f8ace..1c95ff71 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * Copyright (C) 2026 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by From 143e7dc17c61c89573b660097d48927e69e8b415 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:03:01 +0200 Subject: [PATCH 03/10] Test Backporting Signed-off-by: Chaoscaot --- .gitea/workflows/backport-commoncore.yml | 4 ++-- .gitea/workflows/pull-request-build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/backport-commoncore.yml b/.gitea/workflows/backport-commoncore.yml index d53848ad..852b9d23 100644 --- a/.gitea/workflows/backport-commoncore.yml +++ b/.gitea/workflows/backport-commoncore.yml @@ -30,7 +30,7 @@ jobs: id: eligibility shell: bash env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} run: | set -euo pipefail @@ -74,7 +74,7 @@ jobs: if: steps.eligibility.outputs.should_backport == 'true' shell: bash env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} PR_NUMBER: ${{ steps.eligibility.outputs.pr_number }} PR_TITLE: ${{ steps.eligibility.outputs.pr_title }} run: | diff --git a/.gitea/workflows/pull-request-build.yml b/.gitea/workflows/pull-request-build.yml index 5c05c37f..236da389 100644 --- a/.gitea/workflows/pull-request-build.yml +++ b/.gitea/workflows/pull-request-build.yml @@ -47,7 +47,7 @@ jobs: - name: Merge successful backport PR shell: bash env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} BACKPORT_BRANCH_PREFIX: backport/commoncore run: | set -euo pipefail From dae8073992d96c177cf5bb3ab6d00a2025dca8ad Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:03:22 +0200 Subject: [PATCH 04/10] Test Backporting Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/Referee.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/Referee.kt b/CommonCore/SQL/src/de/steamwar/sql/Referee.kt index dc2c00b1..24b9e7d1 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/Referee.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/Referee.kt @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * Copyright (C) 2026 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by From d11467bd1bcd28dc6cdfa4caa3736830c72e5a23 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:09:28 +0200 Subject: [PATCH 05/10] Test Backporting Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/Script.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/Script.kt b/CommonCore/SQL/src/de/steamwar/sql/Script.kt index 12bda03a..a48610a0 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/Script.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/Script.kt @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * Copyright (C) 2026 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by From eea9abdc56afdd6780dac2c944b54dbeae8b5993 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:37:29 +0200 Subject: [PATCH 06/10] Add Templates Signed-off-by: Chaoscaot --- .gitea/ISSUE_TEMPLATE/bug-report.yaml | 60 ++++++++++++++++++++++ .gitea/ISSUE_TEMPLATE/feature-request.yaml | 17 ++++++ 2 files changed, 77 insertions(+) create mode 100644 .gitea/ISSUE_TEMPLATE/bug-report.yaml create mode 100644 .gitea/ISSUE_TEMPLATE/feature-request.yaml diff --git a/.gitea/ISSUE_TEMPLATE/bug-report.yaml b/.gitea/ISSUE_TEMPLATE/bug-report.yaml new file mode 100644 index 00000000..7ce1c896 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug-report.yaml @@ -0,0 +1,60 @@ +name: Bug Report +about: Du hast einen Fehler gefunden? Melde ihn hier! +labels: [ "typ/bug" ] +body: + - type: markdown + attributes: + value: | + ACHTUNG: Sollte es bei dem Bug ein Sicherheitsrisiko geben, melde es bitte auf unserem Discord Server + - type: textarea + id: description + attributes: + label: Description + description: | + Beschreibe deinen Bug in kurzer Form. + - type: input + id: mc-ver + attributes: + label: Minecraft Version + description: Minecraft Version des Clients + validations: + required: true + - type: input + id: mc-ver-ser + attributes: + label: Minecraft Version Server + description: Minecraft Version des Servers, nur bei Bau oder Arenen Servern + - type: dropdown + id: can-reproduce + attributes: + label: Kannst du den Fehler wiederholen? + description: | + Wenn du den Fehler wiederholen kannst, können wir dieses Problem schneller beheben. + Solltest du den Fehler nicht wiederholen können, melde dich bitte auf unserem Discord Server. + options: + - "Yes" + - "No" + validations: + required: true + - type: textarea + id: reproduce-steps + attributes: + label: Wie kannst du den Fehler wiederholen? + description: Welche Schritte musst du ausführen, um den Fehler wiederholen zu können? + validations: + required: true + - type: textarea + id: expected-result + attributes: + label: Was sollte passieren? + description: Was sollte hier deiner Erwartung nach passieren? + - type: input + id: logs + attributes: + label: Auf welchem Server ist der Fehler aufgetreten? + description: Gebe bitte den Namen des Servers an, auf dem der Fehler aufgetreten ist. z.B. "Lobby", "Lixfels Bauserver" etc. + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Sollte es ein Visuelles Problem geben, kannst du hier Screenshots hinzufügen. \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/feature-request.yaml b/.gitea/ISSUE_TEMPLATE/feature-request.yaml new file mode 100644 index 00000000..11fccadc --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/feature-request.yaml @@ -0,0 +1,17 @@ +name: Feature Idee +about: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here! +labels: ["typ/idee"] +body: + - type: textarea + id: description + attributes: + label: Feature Beschreibung + placeholder: | + Ich glaube, dass ... + validations: + required: true + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: Wenn es sich um etwas grafisches handelt, kannst du hier Screenshots hinzufügen. \ No newline at end of file From cfe605508338280bb093dc0882eccf3175369e0e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:38:11 +0200 Subject: [PATCH 07/10] Disable blank issues in Gitea configuration Signed-off-by: Chaoscaot --- .gitea/ISSUE_TEMPLATE/config.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitea/ISSUE_TEMPLATE/config.yml diff --git a/.gitea/ISSUE_TEMPLATE/config.yml b/.gitea/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..ec4bb386 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file From a20b1cb263d1fff28905f3efef2aa7b8854e7787 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:39:04 +0200 Subject: [PATCH 08/10] Disable blank issues in Gitea configuration Signed-off-by: Chaoscaot --- .gitea/ISSUE_TEMPLATE/config.yml | 2 +- .gitea/ISSUE_TEMPLATE/feature-request.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/ISSUE_TEMPLATE/config.yml b/.gitea/ISSUE_TEMPLATE/config.yml index ec4bb386..a49eab2f 100644 --- a/.gitea/ISSUE_TEMPLATE/config.yml +++ b/.gitea/ISSUE_TEMPLATE/config.yml @@ -1 +1 @@ -blank_issues_enabled: false \ No newline at end of file +blank_issues_enabled: true \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/feature-request.yaml b/.gitea/ISSUE_TEMPLATE/feature-request.yaml index 11fccadc..fb8c2a5f 100644 --- a/.gitea/ISSUE_TEMPLATE/feature-request.yaml +++ b/.gitea/ISSUE_TEMPLATE/feature-request.yaml @@ -1,5 +1,5 @@ name: Feature Idee -about: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here! +about: Du hast eine Idee für ein neues Feature, welches SteamWar nicht hat? Stelle sie hier vor. labels: ["typ/idee"] body: - type: textarea From 9a6221b7230538617f647e98f6e70b8cd18aede5 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 15 May 2026 15:44:23 +0200 Subject: [PATCH 09/10] Fix DiscordChannel --- .../discord/channels/DiscordChannel.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/DiscordChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/DiscordChannel.java index 4922d69b..799b3638 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/DiscordChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/DiscordChannel.java @@ -26,6 +26,7 @@ import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.discord.listeners.ChannelListener; import lombok.AllArgsConstructor; import lombok.Getter; +import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.entities.Webhook; import net.dv8tion.jda.api.entities.WebhookClient; @@ -104,10 +105,16 @@ public class DiscordChannel extends Chatter.PlayerlessChatter { return; } - String avatarUrl; + String avatarUrl = null; if (user.getDiscordId() != null) { - avatarUrl = DiscordBot.getGuild().retrieveMemberById(user.getDiscordId()).complete().getEffectiveAvatarUrl(); - } else { + Member member = DiscordBot.getGuild().retrieveMemberById(user.getDiscordId()) + .onErrorMap(throwable -> null) + .complete(); + if (member != null) { + avatarUrl = member.getEffectiveAvatarUrl(); + } + } + if (avatarUrl == null) { avatarUrl = DiscordBot.getInstance().getJda().getSelfUser().getAvatarUrl(); } From 8b33bf40c3dfb9b9d80d3e978e54046b7135d8f9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 May 2026 15:51:01 +0200 Subject: [PATCH 10/10] Add CLI artifact deployment and service restart steps in build workflow Signed-off-by: Chaoscaot --- .gitea/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 09fa125d..21c988f5 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -67,6 +67,7 @@ jobs: cp "VelocityCore/Dependencies/build/libs/Dependencies-all.jar" "deploy/DependenciesVelocityCore.jar" cp "VelocityCore/build/libs/VelocityCore-all.jar" "deploy/VelocityCore.jar" cp "WebsiteBackend/build/libs/WebsiteBackend-all.jar" "deploy/website-api.jar" + cp "CLI/build/distributions/sw.zip" "deploy/sw.zip" - name: Upload deploy artifacts uses: actions/upload-artifact@v3 @@ -130,3 +131,15 @@ jobs: ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'" scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/" + - name: Restart Services + shell: bash + env: + DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }} + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + run: | + set -euo pipefail + + ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "${DEPLOY_USER}@${DEPLOY_HOST}" "sudo systemctl restart api.service" + ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "${DEPLOY_USER}@${DEPLOY_HOST}" "unzip -o /jars/current/sw.zip -d /jars"