sonar-scanner version check #347
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
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 | |