Merge pull request 'Test Backporting' (#343) from test/backporting into main

Reviewed-on: SteamWar/SteamWar#343
This commit is contained in:
2026-05-15 13:54:00 +02:00
2 changed files with 9 additions and 22 deletions
+8 -21
View File
@@ -10,7 +10,6 @@ permissions:
contents: write contents: write
issues: write issues: write
pull-requests: write pull-requests: write
issues: write
jobs: jobs:
backport: backport:
@@ -174,35 +173,23 @@ jobs:
continue continue
fi fi
git push origin "HEAD:refs/heads/${head_branch}" --force-with-lease
if [[ "${#source_commits[@]}" -eq 1 ]]; then if [[ "${#source_commits[@]}" -eq 1 ]]; then
source_text="Source commit: \`${source_commits[0]}\`" source_text="Source commit: \`${source_commits[0]}\`"
else else
source_text="Source commits:" source_text="Source commits:"
for commit in "${source_commits[@]}"; do for commit in "${source_commits[@]}"; do
source_text="${source_text}"$'\n'"- \`${commit}\`" source_text="${source_text} \`${commit}\`"
done done
fi fi
body="$(cat <<BODY 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."
Automated backport of #${pr_number} to \`${target_branch}\` because the source PR changed \`CommonCore/\`.
Source PR: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pulls/${pr_number} git push \
${source_text} -o "topic=${head_branch}" \
-o "title=Backport #${pr_number} to ${target_branch}: ${pr_title}" \
This PR will be merged automatically by the Pull Request Build workflow after a successful build. -o "description=${description}" \
BODY -o "force-push" \
)" origin "HEAD:refs/for/${target_branch}"
payload="$(jq -n \
--arg base "$target_branch" \
--arg head "$head_branch" \
--arg title "Backport #${pr_number} to ${target_branch}: ${pr_title}" \
--arg body "$body" \
'{base: $base, head: $head, title: $title, body: $body}')"
api POST "${repo_path}/pulls" "$payload" >/dev/null
echo "Created backport PR from ${head_branch} to ${target_branch}." echo "Created backport PR from ${head_branch} to ${target_branch}."
git checkout main git checkout main
done done
@@ -1,7 +1,7 @@
/* /*
* This file is a part of the SteamWar software. * 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 * 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 * it under the terms of the GNU Affero General Public License as published by