Skip to content

Commit f81f713

Browse files
committed
Add force-update test mode for RC workflow
1 parent e392b76 commit f81f713

1 file changed

Lines changed: 59 additions & 4 deletions

File tree

.github/workflows/test-spring-boot-rc-version.yml

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
name: Test Spring Boot RC Version
22
on:
33
workflow_dispatch:
4+
inputs:
5+
force_update:
6+
description: 'Force the update flow for testing even when no RC is detected'
7+
required: false
8+
type: boolean
9+
default: false
10+
dry_run:
11+
description: 'Run update steps but skip push/create PR/comment side effects'
12+
required: false
13+
type: boolean
14+
default: true
15+
spring_boot_version:
16+
description: 'Optional override Spring Boot version when force_update is true'
17+
required: false
18+
type: string
19+
spring_cloud_version:
20+
description: 'Optional override Spring Cloud version when force_update is true'
21+
required: false
22+
type: string
423

524
permissions:
625
contents: write
@@ -23,7 +42,39 @@ jobs:
2342
python ./sdk/spring/scripts/generate_spring_cloud_azure_support_file.py --include-rc
2443
- name: Confirm Whether to Update
2544
run: |
26-
if [[ ! -f 'spring-versions.txt' ]]; then
45+
FORCE_UPDATE="${{ github.event.inputs.force_update }}"
46+
MANUAL_BOOT="${{ github.event.inputs.spring_boot_version }}"
47+
MANUAL_CLOUD="${{ github.event.inputs.spring_cloud_version }}"
48+
49+
if [[ "${FORCE_UPDATE}" == 'true' ]]; then
50+
echo "Force update enabled for workflow testing."
51+
52+
if [[ -n "${MANUAL_BOOT}" && -n "${MANUAL_CLOUD}" ]]; then
53+
TARGET_BOOT="${MANUAL_BOOT}"
54+
TARGET_CLOUD="${MANUAL_CLOUD}"
55+
elif [[ -f 'spring-versions.txt' ]]; then
56+
mapfile -t versions < spring-versions.txt
57+
TARGET_BOOT="${versions[0]}"
58+
TARGET_CLOUD="${versions[1]}"
59+
else
60+
echo "force_update=true requires spring-versions.txt or both manual version inputs."
61+
exit 1
62+
fi
63+
64+
PR_NOTES=""
65+
if [[ -f 'pr-descriptions.txt' ]]; then
66+
PR_NOTES="$(<pr-descriptions.txt)"
67+
fi
68+
69+
{
70+
echo "need_update_version=true"
71+
printf 'update_branch=update-spring-dependencies-%s-%s\n' "$(date +%Y%m%d)" "${GITHUB_RUN_ID}"
72+
printf 'spring_boot_version=%s\n' "${TARGET_BOOT}"
73+
printf 'spring_cloud_version=%s\n' "${TARGET_CLOUD}"
74+
printf 'pr_descriptions=%s\n' "${PR_NOTES}"
75+
printf 'PR_TITLE=Test Spring Boot RC version %s and Spring Cloud %s\n' "${TARGET_BOOT}" "${TARGET_CLOUD}"
76+
} >> "$GITHUB_ENV"
77+
elif [[ ! -f 'spring-versions.txt' ]]; then
2778
echo "No new Spring Boot version, no updates!"
2879
elif grep -q -- "-RC" spring-versions.txt; then
2980
echo "Has RC version, create PR to test!"
@@ -63,7 +114,7 @@ jobs:
63114
run: |
64115
python ./sdk/spring/scripts/update_changelog.py -b "${{ env.spring_boot_version }}" -c "${{ env.spring_cloud_version }}"
65116
- name: Push Commit
66-
if: ${{ env.need_update_version == 'true' }}
117+
if: ${{ env.need_update_version == 'true' && github.event.inputs.dry_run != 'true' }}
67118
run: |
68119
git config --global user.email github-actions@github.com
69120
git config --global user.name github-actions
@@ -106,7 +157,7 @@ jobs:
106157
git push origin "HEAD:${{ env.update_branch }}"
107158
- name: Create Pull Request
108159
id: create_pr
109-
if: ${{ env.need_update_version == 'true' }}
160+
if: ${{ env.need_update_version == 'true' && github.event.inputs.dry_run != 'true' }}
110161
uses: actions/github-script@v7
111162
with:
112163
script: |
@@ -122,7 +173,7 @@ jobs:
122173
});
123174
core.setOutput('pull_request_number', String(pr.data.number));
124175
- name: Comment on Pull Request
125-
if: ${{ env.need_update_version == 'true' }}
176+
if: ${{ env.need_update_version == 'true' && github.event.inputs.dry_run != 'true' }}
126177
uses: actions/github-script@v7
127178
with:
128179
script: |
@@ -137,3 +188,7 @@ jobs:
137188
issue_number: prNumber,
138189
body: '/azp run java - spring - tests'
139190
});
191+
- name: Dry Run Summary
192+
if: ${{ env.need_update_version == 'true' && github.event.inputs.dry_run == 'true' }}
193+
run: |
194+
echo "Dry run mode: update steps executed, push/PR/comment were intentionally skipped."

0 commit comments

Comments
 (0)