From 3ed756013884aab36deebbaf6137d78e6533a664 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 10 Feb 2025 14:44:54 +0100 Subject: [PATCH] SQSCANGHA-82 Automate the update of the Scanner CLI version --- .github/workflows/version_update.yml | 11 +++++++++-- action.yml | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/version_update.yml b/.github/workflows/version_update.yml index c0deda7..248d94f 100644 --- a/.github/workflows/version_update.yml +++ b/.github/workflows/version_update.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write steps: - run: sudo apt install -y jq - + - run: sudo snap install yq - uses: actions/checkout@v4 with: ref: master @@ -31,7 +31,13 @@ jobs: run: | ./scripts/fetch_latest_version.sh > sonar-scanner-version cat sonar-scanner-version >> $GITHUB_OUTPUT - + - name: "Update default version" + if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version + shell: bash + env: + NEW_VERSION: ${{ steps.latest-version.outputs.sonar-scanner-version }} + run: | + yq -i '.inputs.scannerVersion.default = "${NEW_VERSION}"' action.yml - name: "Create Pull Request for version update" if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version shell: bash @@ -44,6 +50,7 @@ jobs: git config --global user.email "sonartech@sonarsource.com" git checkout -b ${UPDATE_BRANCH} git add sonar-scanner-version + git add action.yml git commit -m "${TITLE}" git push --force-with-lease origin ${UPDATE_BRANCH} gh pr list diff --git a/action.yml b/action.yml index 642e1c3..410ef16 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,8 @@ inputs: scannerVersion: description: Version of the Sonar Scanner CLI to use required: false - default: 6.2.1.4610 # to be kept in sync with sonar-scanner-version + # to be kept in sync with sonar-scanner-version + default: 6.2.1.4610 scannerBinariesUrl: description: URL to download the Sonar Scanner CLI binaries from required: false