Bump pylint from 3.2.3 to 3.2.4 (#748) #1
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: SonarCloud Setup | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- integrations/** | |
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_ignore: | |
integrations/_infra/** | |
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 | |
setup-sonarcloud: | |
if: ${{ needs.pre-run.outputs.count_changed_integrations > 0 }} | |
needs: pre-run | |
runs-on: ubuntu-latest | |
name: Create new project for integrations | |
strategy: | |
matrix: ${{ fromJson(needs.pre-run.outputs.changed_integrations) }} | |
steps: | |
- name: Create integration variable | |
run: | | |
unsplit_integ="${{ matrix.integrations }}" | |
integration=${unsplit_integ##*/} | |
echo "INTEG_NAME=${integration}" >> $GITHUB_ENV | |
echo "INTEG_PROJECT_ID=port-labs_ocean_${integration}" >> $GITHUB_ENV | |
integration=$(echo ${integration} | tr '-' '_') # replace '-'' with '_' | |
integration=$(echo ${integration} | awk '{print toupper($0)}') # Uppercase the string | |
echo "INTEG_SECRET_NAME=${integration}" >> $GITHUB_ENV | |
- name: Check if SonarCloud project exists | |
id: check_project | |
run: | | |
PROJECT_EXISTS=$(curl -u ${{ secrets.CREATE_SONARCLOUD_PROJECT_TOKEN }}: -X GET "https://sonarcloud.io/api/projects/search?projects=${{ env.INTEG_PROJECT_ID }}&organization=port-labs" | jq '.components | length > 0') | |
echo "PROJECT_EXISTS=$PROJECT_EXISTS" >> $GITHUB_ENV | |
- name: Create SonarCloud project and token | |
if: env.PROJECT_EXISTS == 'false' | |
run: | | |
# Create Project | |
curl -u ${{ secrets.CREATE_SONARCLOUD_PROJECT_TOKEN }}: -X POST "https://sonarcloud.io/api/projects/create?name=Ocean-${{env.INTEG_NAME}}&project=${{ env.INTEG_PROJECT_ID }}&visibility=public&organization=port-labs" | |
# Rename main branch to "main" | |
curl -u ${{ secrets.CREATE_SONARCLOUD_PROJECT_TOKEN }}: -X POST "https://sonarcloud.io/api/project_branches/rename?name=main&project=${{ env.INTEG_PROJECT_ID }}" | |
# Generate Token | |
SONAR_TOKEN=$(curl -u ${{ secrets.CREATE_SONARCLOUD_PROJECT_TOKEN }}: -X POST "https://sonarcloud.io/api/user_tokens/generate?name=${{env.INTEG_NAME}}-token" | jq -r '.token') | |
echo "SONAR_TOKEN=$SONAR_TOKEN" >> $GITHUB_ENV | |
- name: Create GitHub Repo Secret | |
if: env.SONAR_TOKEN != '' | |
uses: gliech/create-github-secret-action@v1 | |
with: | |
name: ${{ env.INTEG_SECRET_NAME }} | |
value: ${{ env.SONAR_TOKEN }} | |
pa_token: ${{ secrets.PA_TOKEN_FOR_SECRET_CREATION }} |