diff --git a/.github/workflows/ruling-diff-comment.yml b/.github/workflows/ruling-diff-comment.yml new file mode 100644 index 00000000000..59ffa7316ad --- /dev/null +++ b/.github/workflows/ruling-diff-comment.yml @@ -0,0 +1,59 @@ +name: Ruling Diff Comment + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + # Trigger on ruling JSON file changes + - 'its/ruling/src/test/resources/**/*.json' + # Uncomment to test action changes + - '.github/workflows/ruling-diff-comment.yml' + workflow_dispatch: + inputs: + pr-number: + description: 'Pull request number' + required: true + type: string + base-sha: + description: 'Base commit SHA for diff' + required: true + type: string + head-sha: + description: 'Head commit SHA for diff' + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: write + +jobs: + ruling-diff-comment: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Install uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + enable-cache: true + + # Use the action from the branch we just pushed + - name: Post ruling diff comment + uses: SonarSource/core-languages-tooling-public/ruling-diff-comment@master + with: + pr-number: ${{ inputs.pr-number || github.event.pull_request.number }} + repository: ${{ github.repository }} + base-sha: ${{ inputs.base-sha || github.event.pull_request.base.sha }} + head-sha: ${{ inputs.head-sha || github.event.pull_request.head.sha }} + ruling-root: 'its/ruling/src/test/resources' + sources-root: 'its/sources' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}