Skip to content

Commit b5279ce

Browse files
SONARJAVA-6077 Update "Prepare Next Development Iteration" workflow (#5422)
1 parent 2454088 commit b5279ce

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/PrepareNextIteration.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
nextVersion:
7-
description: Version number of the next iteration
7+
description: Version number of the next iteration (e.g. 8.4-SNAPSHOT)
88
required: true
99

1010
jobs:
@@ -15,20 +15,36 @@ jobs:
1515
pull-requests: write
1616
contents: write
1717

18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
NEXT_VERSION: ${{ inputs.nextVersion }}
21+
1822
steps:
1923

2024
- name: Checkout Sources
2125
uses: actions/checkout@v4
2226

2327
- name: Update Version Number
24-
env:
25-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
NEXT_VERSION: ${{ inputs.nextVersion }}
2728
run: |
2829
git config user.name "${GITHUB_ACTOR}"
2930
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
30-
git checkout -b gh-action/next-iteration
31+
git config --global core.autocrlf input
32+
git config --global core.safecrlf true
33+
BRANCH="gh-action/next-iteration.${{ github.run_id }}"
34+
git checkout -b "${BRANCH}"
3135
mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${NEXT_VERSION}"
3236
git commit -m 'Prepare next development iteration' -a
33-
git push --set-upstream origin gh-action/next-iteration
34-
gh pr create -B master --title 'Prepare next development iteration' --body ''
37+
git push --set-upstream origin "${BRANCH}"
38+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
39+
40+
- name: Create Pull Request
41+
id: create-pr
42+
run: |
43+
URL=$(gh pr create --draft --base master --title "Prepare next development iteration ${NEXT_VERSION}" --body '')
44+
echo "url=${URL}" >> $GITHUB_OUTPUT
45+
46+
- name: Summary
47+
run: |
48+
echo "Generated ${{steps.create-pr.outputs.url}}." >> $GITHUB_STEP_SUMMARY
49+
echo "New version set to ${NEXT_VERSION}." >> $GITHUB_STEP_SUMMARY
50+
echo "Tip: close and reopen the PR to trigger CI. " >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)