Skip to content

[Integration][Datadog] Add support to fetch history of slo history (#… #2

[Integration][Datadog] Add support to fetch history of slo history (#…

[Integration][Datadog] Add support to fetch history of slo history (#… #2

name: Sonarcloud scan integrations
on:
push:
branches:
- main
paths:
- integrations/**
workflow_dispatch:
jobs:
pre-run:
outputs:
changed_integrations: ${{ steps.create-matrix.outputs.INTEGRATIONS_MATRIX }}
count_changed_integrations: ${{steps.changed-integrations.outputs.all_modified_files_count }}
name: Build Sonarcloud scan run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get all changed integrations
id: changed-integrations
uses: tj-actions/changed-files@v44
with:
json: true
dir_names: true
dir_names_max_depth: 2
files: |
integrations/**
- name: Output changes integrations
id: create-matrix
run: |
echo ${{ steps.changed-integrations.outputs.all_changed_files }}
integrations_array=${{ steps.changed-integrations.outputs.all_changed_files }}
echo "INTEGRATIONS_MATRIX=$(jq -cn --argjson integArr $integrations_array '{integrations: $integArr}')" >> $GITHUB_OUTPUT
sonarcloud-scan:
name: Sonarcloud scan changed integrations
needs: pre-run
if: ${{ needs.pre-run.outputs.count_changed_integrations > 0 }}
strategy:
matrix: ${{ fromJson(needs.pre-run.outputs.changed_integrations) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create integration variable
run: |
unsplit_integ="${{ matrix.integrations }}"
integration=${unsplit_integ##*/}
integration=$(echo ${integration} | tr '-' '_')
integration=$(echo ${integration} | awk '{print toupper($0)}')
echo "INTEG_NAME=${integration}" >> $GITHUB_ENV
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets[env.INTEG_NAME] }}
with:
projectBaseDir: ${{ matrix.integrations }}