-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SC-6130,SC-6137 Automatic PR creation and save expected URL and SHA i…
…n repository
- Loading branch information
1 parent
5ad6792
commit 7c53cdf
Showing
7 changed files
with
160 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: sonar-scanner version check | ||
on: | ||
schedule: | ||
- cron: '15 10 * * *' | ||
|
||
jobs: | ||
update-version: | ||
name: Prepare pull request for sonar-scanner version update | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: sudo apt install -y jq | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
persist-credentials: true | ||
fetch-depth: 0 | ||
|
||
- name: "Fetch currently used sonar-scanner version" | ||
id: tagged-version | ||
shell: bash | ||
run: cat sonar-scanner-version >> $GITHUB_OUTPUT | ||
|
||
- name: "Fetch lastest sonar-scanner version" | ||
id: latest-version | ||
shell: bash | ||
run: | | ||
./scripts/fetch_latest_version.sh > sonar-scanner-version | ||
cat sonar-scanner-version >> $GITHUB_OUTPUT | ||
- name: "Create Pull Request for version update" | ||
if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version | ||
shell: bash | ||
env: | ||
UPDATE_BRANCH: update-to-sonar-scanner-${{ steps.latest-version.outputs.sonar-scanner-version }} | ||
TITLE: "Update sonar-scanner-version to ${{ steps.latest-version.outputs.sonar-scanner-version }}" | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name "SonarTech" | ||
git config --global user.email "[email protected]" | ||
git checkout -b ${UPDATE_BRANCH} | ||
git add sonar-scanner-version | ||
git commit -m "${TITLE}" | ||
git push --force-with-lease origin ${UPDATE_BRANCH} | ||
gh pr list | ||
if [[ $(gh pr list -H "${UPDATE_BRANCH}" | grep "${UPDATE_BRANCH}" | wc -l) -eq 0 ]]; then | ||
gh pr create -B main -H ${UPDATE_BRANCH} --title "${TITLE}" --body "Automatic updated of sonar-scanner version value. Needs to be tagged for release." | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
source "$(dirname -- "$0")/utils.sh" | ||
|
||
SONAR_SCANNER_VERSION=$(curl -sSL -H "Accept: application/vnd.github+json" \ | ||
https://api.github.com/repos/SonarSource/sonar-scanner-cli/releases/latest | jq -r '.tag_name') | ||
check_status "Failed to fetch latest sonar-scanner version from GitHub API" | ||
|
||
echo "sonar-scanner-version=${SONAR_SCANNER_VERSION}" | ||
|
||
for OS in windows linux macosx; do | ||
SONAR_SCANNER_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-${OS}.zip" | ||
SONAR_SCANNER_SHA=$(curl -sSL "${SONAR_SCANNER_URL}.sha256") | ||
check_status "Failed to download ${OS} sonar-scanner checksum from '${SONAR_SCANNER_URL}'" | ||
|
||
echo "sonar-scanner-url-${OS}=${SONAR_SCANNER_URL}" | ||
echo "sonar-scanner-sha-${OS}=${SONAR_SCANNER_SHA}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sonar-scanner-version=4.7.0.2747 | ||
sonar-scanner-url-windows=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-windows.zip | ||
sonar-scanner-sha-windows=9e9e425b2c9123622436a5004c5b6cf833800bd0ec717c3bd5ea506efc0f998e | ||
sonar-scanner-url-linux=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip | ||
sonar-scanner-sha-linux=3e121d85a4adb1f30b917d5f3eb897966b59e02c3d6d313a78dcd964193dc963 | ||
sonar-scanner-url-macosx=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-macosx.zip | ||
sonar-scanner-sha-macosx=977a70d360b9eaea89c965edfb29eb661dbc9fcc6c0e40037809f089f9a91339 |