From: Jérôme Benoit Date: Wed, 22 Apr 2026 21:52:47 +0000 (+0200) Subject: ci: one-shot job to rename SonarCloud main branch from master to main X-Git-Tag: cli@v4.5.0~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=49916e81a02770741ffea6e242de42b8c91d1612;p=e-mobility-charging-stations-simulator.git ci: one-shot job to rename SonarCloud main branch from master to main Renames the main branch on all 4 SonarCloud projects via the project_branches/rename API. Remove this job after first successful run. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea7422f2..8622f698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,31 @@ jobs: echo "defined=false" >> $GITHUB_OUTPUT; fi + # TODO: remove this job after first successful run + fix-sonarcloud-main-branch: + needs: [check-secrets] + if: ${{ needs.check-secrets.outputs.sonar-token-exists == 'true' && github.event_name == 'push' }} + runs-on: ubuntu-latest + steps: + - name: Rename SonarCloud main branch from master to main + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + for project in \ + e-mobility-charging-stations-simulator \ + e-mobility-charging-stations-simulator-ui-common \ + e-mobility-charging-stations-simulator-cli \ + e-mobility-charging-stations-simulator-webui + do + http_code=$(curl --silent --output /dev/null --write-out '%{http_code}' \ + --request POST \ + 'https://sonarcloud.io/api/project_branches/rename' \ + -H "Authorization: Bearer ${SONAR_TOKEN}" \ + -H 'Content-Type: application/x-www-form-urlencoded' \ + -d "project=${project}&name=main") + echo "${project}: HTTP ${http_code}" + done + build-ocpp-server: strategy: matrix: