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
issues: write
pull-requests: write
issues: write
jobs:
backport:
@@ -174,35 +173,23 @@ jobs:
continue
fi
git push origin "HEAD:refs/heads/${head_branch}" --force-with-lease
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}"$'\n'"- \`${commit}\`"
source_text="${source_text} \`${commit}\`"
done
fi
body="$(cat <<BODY
Automated backport of #${pr_number} to \`${target_branch}\` because the source PR changed \`CommonCore/\`.
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."
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.
BODY
)"
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
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
done
@@ -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