Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
56fd93a474
|
|||
|
cb153b50f1
|
|||
|
8b33bf40c3
|
|||
| 9a6221b723 | |||
|
a20b1cb263
|
|||
|
cfe6055083
|
|||
|
eea9abdc56
|
|||
| c27789daa8 | |||
| 56a7344d67 | |||
| 138b94e562 | |||
|
d11467bd1b
|
|||
| 7be40d9bf9 | |||
|
dae8073992
|
|||
|
143e7dc17c
|
|||
| f4ace64173 | |||
|
236b486845
|
|||
|
c666f0228d
|
|||
| bd471330e1 | |||
|
92602efa9e
|
|||
|
55a39ac85a
|
|||
|
39898825ef
|
|||
| 59a2d1454e | |||
|
16c324cf32
|
|||
|
b923b98b2c
|
|||
| afca7d5135 | |||
|
a05bebcd81
|
|||
|
02cc8330ca
|
|||
|
f8397b8bab
|
|||
| 38603fbe45 | |||
|
78700e868d
|
|||
|
259e8bdb7b
|
|||
| 0ea3c25b7b | |||
|
2fa1b7d329
|
|||
| af805f6ba4 | |||
|
34c361d3f8
|
|||
| 83eb621b0f | |||
|
65aaf4857d
|
@@ -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.
|
||||
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: true
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Feature Idee
|
||||
about: Du hast eine Idee für ein neues Feature, welches SteamWar nicht hat? Stelle sie hier vor.
|
||||
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.
|
||||
@@ -2,200 +2,192 @@ name: Backport CommonCore
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
types:
|
||||
- closed
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
BACKPORT_PATH: CommonCore
|
||||
BACKPORT_BRANCH_PREFIX: backport/commoncore
|
||||
DISABLE_BACKPORT_LABEL: no-backport
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
name: Backport CommonCore changes
|
||||
name: Create CommonCore backport PRs
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
- name: Create version branch backports
|
||||
- name: Check backport eligibility
|
||||
id: eligibility
|
||||
shell: bash
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
api() {
|
||||
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)"
|
||||
echo "pr_number=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")"
|
||||
echo "pr_title<<EOF"
|
||||
jq -r '.pull_request.title' "$GITHUB_EVENT_PATH"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
labels="$(curl -fsS \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
"${api_url}/repos/${GITHUB_REPOSITORY}/labels")"
|
||||
|
||||
if ! jq -e --arg disable_backport_label "$DISABLE_BACKPORT_LABEL" 'any(.[]; .name == $disable_backport_label)' <<< "$labels" >/dev/null; then
|
||||
curl -fsS -X POST \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg name "$DISABLE_BACKPORT_LABEL" --arg color "ededed" --arg description "Disable automatic CommonCore backporting for this pull request." '{name: $name, color: $color, description: $description}')" \
|
||||
"${api_url}/repos/${GITHUB_REPOSITORY}/labels"
|
||||
fi
|
||||
|
||||
- name: Create backport pull requests
|
||||
if: steps.eligibility.outputs.should_backport == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||
PR_NUMBER: ${{ steps.eligibility.outputs.pr_number }}
|
||||
PR_TITLE: ${{ steps.eligibility.outputs.pr_title }}
|
||||
run: |
|
||||
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 body="${3:-}"
|
||||
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 "$body" ]]; then
|
||||
curl --fail --silent --show-error \
|
||||
-X "$method" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "$body" \
|
||||
"${GITHUB_API_URL}${path}"
|
||||
else
|
||||
curl --fail --silent --show-error \
|
||||
-X "$method" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Accept: application/json" \
|
||||
"${GITHUB_API_URL}${path}"
|
||||
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
|
||||
}
|
||||
|
||||
repo_path="/repos/${GITHUB_REPOSITORY}"
|
||||
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
|
||||
pr_title="$(jq -r '.pull_request.title // ""' "$GITHUB_EVENT_PATH")"
|
||||
event_commit="$(jq -r '.pull_request.merge_commit_sha // .pull_request.merged_commit_id // .commit_id // env.GITHUB_SHA' "$GITHUB_EVENT_PATH")"
|
||||
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}"
|
||||
|
||||
commoncore_files=()
|
||||
page=1
|
||||
while true; do
|
||||
response="$(api GET "${repo_path}/pulls/${pr_number}/files?page=${page}&limit=50")"
|
||||
count="$(jq 'length' <<< "$response")"
|
||||
while IFS= read -r file; do
|
||||
[[ -n "$file" ]] && commoncore_files+=("$file")
|
||||
done < <(jq -r '.[] | (.filename // .path // .name // "") | select(startswith("CommonCore/"))' <<< "$response")
|
||||
git config user.name "SteamWar Backport Bot"
|
||||
git config user.email "actions@steamwar.de"
|
||||
|
||||
[[ "$count" -lt 50 ]] && break
|
||||
page=$((page + 1))
|
||||
done
|
||||
if [[ "${GITHUB_SERVER_URL}" == https://* ]]; then
|
||||
auth_host="${GITHUB_SERVER_URL#https://}"
|
||||
git remote set-url origin "https://oauth2:${GITHUB_TOKEN}@${auth_host}/${GITHUB_REPOSITORY}.git"
|
||||
fi
|
||||
|
||||
if [[ "${#commoncore_files[@]}" -eq 0 ]]; then
|
||||
echo "PR #${pr_number} did not change CommonCore/; nothing to backport."
|
||||
git fetch --prune origin '+refs/heads/version/*:refs/remotes/origin/version/*'
|
||||
|
||||
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}${repo_api_path}/pulls/${PR_NUMBER}.diff" \
|
||||
-o pull-request.diff
|
||||
|
||||
if ! grep -Eq "^diff --git a/${BACKPORT_PATH}/" pull-request.diff; then
|
||||
echo "Pull request #${PR_NUMBER} has no ${BACKPORT_PATH} changes to backport."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "PR #${pr_number} changed CommonCore files:"
|
||||
printf ' - %s\n' "${commoncore_files[@]}"
|
||||
|
||||
pr_commits=()
|
||||
page=1
|
||||
while true; do
|
||||
response="$(api GET "${repo_path}/pulls/${pr_number}/commits?page=${page}&limit=50")"
|
||||
count="$(jq 'length' <<< "$response")"
|
||||
while IFS= read -r commit; do
|
||||
[[ -n "$commit" ]] && pr_commits+=("$commit")
|
||||
done < <(jq -r '.[] | .sha // .id // empty' <<< "$response")
|
||||
|
||||
[[ "$count" -lt 50 ]] && break
|
||||
page=$((page + 1))
|
||||
done
|
||||
|
||||
source_commits=("$event_commit")
|
||||
if [[ "${#pr_commits[@]}" -gt 1 ]]; then
|
||||
for commit in "${pr_commits[@]}"; do
|
||||
if [[ "$commit" == "$event_commit" ]]; then
|
||||
source_commits=("${pr_commits[@]}")
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Using source commit plan:"
|
||||
printf ' - %s\n' "${source_commits[@]}"
|
||||
|
||||
git config --global user.name "SteamWar Backport Bot"
|
||||
git config --global user.email "backport-bot@steamwar.de"
|
||||
git fetch origin '+refs/heads/*:refs/remotes/origin/*'
|
||||
|
||||
for commit in "${source_commits[@]}"; do
|
||||
git cat-file -e "${commit}^{commit}"
|
||||
done
|
||||
|
||||
mapfile -t version_branches < <(
|
||||
git for-each-ref --format='%(refname:short)' refs/remotes/origin/version |
|
||||
sed 's#^origin/##' |
|
||||
sort -u
|
||||
)
|
||||
|
||||
if [[ "${#version_branches[@]}" -eq 0 ]]; then
|
||||
echo "No origin/version/* branches found; nothing to backport."
|
||||
mapfile -t target_branches < <(git for-each-ref --format='%(refname:strip=3)' refs/remotes/origin/version)
|
||||
if [[ "${#target_branches[@]}" -eq 0 ]]; then
|
||||
echo "No version/* branches found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
failures=()
|
||||
for target_branch in "${version_branches[@]}"; do
|
||||
safe_target="$(sed -E 's#[^A-Za-z0-9._-]+#-#g; s#^-+##; s#-+$##' <<< "$target_branch")"
|
||||
head_branch="backport/pr-${pr_number}-to-${safe_target}"
|
||||
for target_branch in "${target_branches[@]}"; do
|
||||
safe_target="${target_branch//\//-}"
|
||||
backport_branch="${BACKPORT_BRANCH_PREFIX}/pr-${PR_NUMBER}-to-${safe_target}"
|
||||
|
||||
existing_pr="$(api GET "${repo_path}/pulls?state=open&base_branch=$(jq -rn --arg value "$target_branch" '$value|@uri')&limit=50" |
|
||||
jq -r --arg head "$head_branch" '.[] | select(.head.ref == $head) | .number' |
|
||||
head -n 1)"
|
||||
git checkout -B "${backport_branch}" "origin/${target_branch}"
|
||||
git reset --hard "origin/${target_branch}"
|
||||
|
||||
if [[ -n "$existing_pr" ]]; then
|
||||
echo "Backport PR #${existing_pr} already exists for ${target_branch}; leaving it unchanged."
|
||||
if ! git apply --3way --index --include="${BACKPORT_PATH}/**" pull-request.diff; then
|
||||
echo "Failed to apply CommonCore backport for ${target_branch}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git diff --cached --quiet; then
|
||||
echo "CommonCore changes from #${PR_NUMBER} are already present in ${target_branch}."
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Creating ${head_branch} from ${target_branch}"
|
||||
git checkout -B "$head_branch" "origin/${target_branch}"
|
||||
git commit -m "Backport CommonCore changes from #${PR_NUMBER}" -m "${PR_TITLE}"
|
||||
git push --force-with-lease origin "${backport_branch}"
|
||||
|
||||
for commit in "${source_commits[@]}"; do
|
||||
cherry_pick_args=(-x)
|
||||
if [[ "$(git rev-list --parents -n 1 "$commit" | wc -w)" -gt 2 ]]; then
|
||||
cherry_pick_args=(-x -m 1)
|
||||
fi
|
||||
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 git cherry-pick "${cherry_pick_args[@]}" "$commit"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ -z "$(git status --porcelain)" ]]; then
|
||||
echo "Cherry-pick of ${commit} produced no changes; skipping it."
|
||||
git cherry-pick --skip || true
|
||||
continue
|
||||
fi
|
||||
|
||||
git cherry-pick --abort || true
|
||||
failures+=("${target_branch}: cherry-pick of ${commit} failed")
|
||||
break
|
||||
done
|
||||
|
||||
if [[ "${failures[*]:-}" == *"${target_branch}:"* ]]; then
|
||||
git checkout main
|
||||
if [[ -n "$open_pr_number" ]]; then
|
||||
echo "Backport PR #${open_pr_number} already exists for ${target_branch}."
|
||||
continue
|
||||
fi
|
||||
|
||||
if git diff --quiet "origin/${target_branch}" HEAD; then
|
||||
echo "${target_branch} already contains the change; no PR needed."
|
||||
git checkout main
|
||||
continue
|
||||
fi
|
||||
pr_body="$(printf 'Automatic CommonCore backport of #%s.\n\nOriginal PR title: %s\n\nOnly files below `CommonCore/` are included.' "$PR_NUMBER" "$PR_TITLE")"
|
||||
|
||||
if [[ "${#source_commits[@]}" -eq 1 ]]; then
|
||||
source_text="Source commit: \`${source_commits[0]}\`"
|
||||
else
|
||||
source_text="Source commits:"
|
||||
for commit in "${source_commits[@]}"; do
|
||||
source_text="${source_text} \`${commit}\`"
|
||||
done
|
||||
fi
|
||||
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
|
||||
|
||||
description="Automated backport of #${pr_number} to ${target_branch} because the source PR changed CommonCore/. Source PR: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pulls/${pr_number}. ${source_text}. This PR will be merged automatically by the Pull Request Build workflow after a successful build."
|
||||
|
||||
git push \
|
||||
-o "topic=${head_branch}" \
|
||||
-o "title=Backport #${pr_number} to ${target_branch}: ${pr_title}" \
|
||||
-o "description=${description}" \
|
||||
-o "force-push" \
|
||||
origin "HEAD:refs/for/${target_branch}"
|
||||
echo "Created backport PR from ${head_branch} to ${target_branch}."
|
||||
git checkout main
|
||||
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
|
||||
|
||||
if [[ "${#failures[@]}" -gt 0 ]]; then
|
||||
echo "Backport failures:"
|
||||
printf ' - %s\n' "${failures[@]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -3,6 +3,10 @@ name: Pull Request Build
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
@@ -40,33 +44,33 @@ jobs:
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build --no-daemon
|
||||
|
||||
merge-backport:
|
||||
name: Merge backport
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: ${{ startsWith(github.event.pull_request.base.ref, 'version/') && startsWith(github.event.pull_request.head.ref, 'backport/pr-') }}
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Merge successful backport PR
|
||||
shell: bash
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||
BACKPORT_BRANCH_PREFIX: backport/commoncore
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
pr_number="$(jq -r '.number' "$GITHUB_EVENT_PATH")"
|
||||
target_branch="$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")"
|
||||
payload="$(jq -n \
|
||||
--arg title "Merge backport #${pr_number} into ${target_branch}" \
|
||||
'{Do: "merge", MergeTitleField: $title, MergeMessageField: "Automatic CommonCore backport after successful build.", delete_branch_after_merge: true}')"
|
||||
head_branch="$(jq -r '.pull_request.head.ref // ""' "$GITHUB_EVENT_PATH")"
|
||||
base_branch="$(jq -r '.pull_request.base.ref // ""' "$GITHUB_EVENT_PATH")"
|
||||
pr_number="$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH")"
|
||||
|
||||
curl --fail --silent --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
if [[ "${head_branch}" != "${BACKPORT_BRANCH_PREFIX}/"* ]]; then
|
||||
echo "Not a CommonCore backport PR."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${base_branch}" != version/* ]]; then
|
||||
echo "Backport PR target is not a version/* branch."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
api_url="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}"
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "$payload" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"
|
||||
-d '{"Do":"merge","delete_branch_after_merge":true}' \
|
||||
"${api_url}/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}/merge"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user