diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index adc919372bd..50281672de8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,6 +117,48 @@ jobs: expected-dir: src/test/resources actual-dir: target/actual + ruling-update-notify: + name: Ruling Update and Notify + needs: ruling-qa + if: always() && github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Install uv + uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 + with: + enable-cache: true + + - name: Check ruling-qa results + id: check-ruling + run: | + # Check if any ruling-qa job failed + # For matrix jobs, needs.ruling-qa.result can be 'success' only if ALL jobs succeeded + RULING_FAILED=false + if [[ "${{ needs.ruling-qa.result }}" != "success" ]]; then + RULING_FAILED=true + fi + echo "ruling-failed=$RULING_FAILED" >> "$GITHUB_OUTPUT" + echo "Ruling QA result: ${{ needs.ruling-qa.result }}, failed=$RULING_FAILED" + + - name: Update ruling and notify + uses: SonarSource/core-languages-tooling-public/ruling-update-and-notify@master + with: + pr-number: ${{ github.event.pull_request.number }} + ruling-failed: ${{ steps.check-ruling.outputs.ruling-failed }} + ruling-root: 'its/ruling/src/test/resources' + sources-root: 'its/sources' + env: + GH_TOKEN: ${{ github.token }} + plugin-qa: strategy: fail-fast: false