Skip to content

Commit 01850e2

Browse files
committed
SQSCANGHA-94 Fix the scanner-update workflow
1 parent 8c71dc0 commit 01850e2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/version_update.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest-large
1111
outputs:
1212
should_update: ${{ steps.version-check.outputs.should_update }}
13-
latest_version: ${{ steps.latest-version.outputs.latest }}
13+
new-version: ${{ steps.latest-version.outputs.sonar-scanner-version }}
1414
steps:
1515
- run: sudo apt install -y jq
16-
- run: sudo snap install yq
1716
- uses: actions/checkout@v4
1817
with:
1918
ref: master
20-
persist-credentials: true
2119
fetch-depth: 0
2220

2321
- name: "Fetch currently used sonar-scanner version"
@@ -30,13 +28,13 @@ jobs:
3028
shell: bash
3129
run: |
3230
./scripts/fetch_latest_version.sh > sonar-scanner-version
33-
echo "latest=$(cat sonar-scanner-version)" >> $GITHUB_OUTPUT
31+
cat sonar-scanner-version >> $GITHUB_OUTPUT
3432
3533
- name: "Determine if update is needed"
3634
id: version-check
3735
shell: bash
3836
run: |
39-
if [[ "${{ steps.tagged-version.outputs.sonar-scanner-version }}" != "${{ steps.latest-version.outputs.latest }}" ]]; then
37+
if [[ "${{ steps.tagged-version.outputs.sonar-scanner-version }}" != "${{ steps.latest-version.outputs.sonar-scanner-version }}" ]]; then
4038
echo "should_update=true" >> $GITHUB_OUTPUT
4139
else
4240
echo "should_update=false" >> $GITHUB_OUTPUT
@@ -51,17 +49,24 @@ jobs:
5149
pull-requests: write
5250
if: needs.check-version.outputs.should_update == 'true'
5351
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
ref: master
55+
persist-credentials: true
56+
fetch-depth: 0
57+
- run: sudo snap install yq
5458
- name: "Update default version"
5559
shell: bash
5660
env:
57-
NEW_VERSION: ${{ needs.check-version.outputs.latest-version }}
61+
NEW_VERSION: ${{ needs.check-version.outputs.new-version }}
5862
run: |
59-
yq -i '.inputs.scannerVersion.default = strenv(NEW_VERSION)' action.yml
63+
yq -i '.inputs.scannerVersion.default = strenv(NEW_VERSION)' action.yml
64+
./scripts/fetch_latest_version.sh > sonar-scanner-version
6065
- name: "Create Pull Request for version update"
6166
shell: bash
6267
env:
63-
UPDATE_BRANCH: update-to-sonar-scanner-${{ needs.check-version.outputs.latest-version }}
64-
TITLE: "Update SonarScanner CLI to ${{ needs.check-version.outputs.latest-version }}"
68+
UPDATE_BRANCH: update-to-sonar-scanner-${{ needs.check-version.outputs.new-version }}
69+
TITLE: "Update SonarScanner CLI to ${{ needs.check-version.outputs.new-version }}"
6570
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6671
run: |
6772
git config --global user.name "SonarTech"
@@ -74,5 +79,5 @@ jobs:
7479
gh pr list
7580
7681
if [[ $(gh pr list -H "${UPDATE_BRANCH}" | grep "${UPDATE_BRANCH}" | wc -l) -eq 0 ]]; then
77-
gh pr create -B master -H ${UPDATE_BRANCH} --title "${TITLE}" --body "Automatic updated of sonar-scanner version value. Needs to be tagged for release."
82+
gh pr create -B master -H ${UPDATE_BRANCH} --title "${TITLE}" --body "Automatic update of the sonar-scanner version value. Be sure to trigger the QA workflow by closing and reopening this PR (see https://github.com/orgs/community/discussions/65321)."
7883
fi

0 commit comments

Comments
 (0)