SONARTEXT-802 Fix slack notification for public and private builds (#… #94
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - branch-* | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '30 17 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }} | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: sonar-s-public | |
| name: Build | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1 | |
| with: | |
| version: 2025.7.12 | |
| - name: Checkout build logic only | |
| run: | | |
| git submodule update --init --depth 1 -- build-logic/common | |
| - name: Create Gradle User Home | |
| shell: bash | |
| run: | | |
| export GRADLE_USER_HOME=${GITHUB_WORKSPACE}/.gradle | |
| mkdir -p ${GRADLE_USER_HOME} | |
| echo "GRADLE_USER_HOME=${GRADLE_USER_HOME}" >> $GITHUB_ENV | |
| - name: Cache Gradle Dependencies | |
| uses: SonarSource/ci-github-actions/cache@v1 | |
| with: | |
| path: ${{ env.GRADLE_USER_HOME }} | |
| key: gradle-${{ env.GRADLE_CACHE_KEY }} | |
| - name: Build, test and analyze | |
| id: build | |
| uses: SonarSource/ci-github-actions/build-gradle@v1 | |
| with: | |
| public: true | |
| deploy-pull-request: false | |
| skip-tests: false | |
| use-develocity: true | |
| gradle-args: "--build-cache -x artifactoryPublish -Dsonar.projectName=SonarText" | |
| disable-caching: true | |
| shadow-scan: ${{ github.event_name == 'schedule' }} | |
| notify_slack: | |
| name: Notify Slack on Failure | |
| needs: [ build ] | |
| if: >- | |
| failure() && ! cancelled() && | |
| (github.ref_name == github.event.repository.default_branch || | |
| startsWith(github.ref_name, 'branch-') || | |
| startsWith(github.ref_name, 'feature/')) | |
| permissions: | |
| id-token: write | |
| statuses: read | |
| runs-on: github-ubuntu-latest-s | |
| steps: | |
| - uses: SonarSource/release-github-actions/notify-slack@v1 | |
| with: | |
| project-name: "SonarText - Public" | |
| slack-channel: "squad-security-cloud-notifs" | |
| icon: ':shushing_face:' | |
| jobs: ${{ toJSON(needs) }} |