From 7d03bf78b7834981d5b9741910127b7bd9c93b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:02:41 -0300 Subject: [PATCH 1/3] docs(#83): fix workflow for sonarcloud --- .github/workflows/code-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 8b735ed..98491df 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -2,7 +2,7 @@ name: Build for Sonar on: push: branches: - - main + - dev pull_request: types: [opened, synchronize, reopened] jobs: @@ -47,4 +47,4 @@ jobs: -Dsonar.organization=fga-eps-mds-1 \ -Dsonar.projectKey=fga-eps-mds_2024.2-ARANDU-APP\ -Dsonar.sources=./lib \ - -Dsonar.host.url=https://sonarcloud.io \ No newline at end of file + -Dsonar.host.url=https://sonarcloud.io From 03160d5266aac6e8ec039c38b52c976149f7a414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:17:03 -0300 Subject: [PATCH 2/3] FIX(#83): fix action to send metrics to doc repo Co-authored-by: gabrielm2q --- .github/workflows/metrics.yml | 79 ++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 0fcc335..70e141d 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -1,40 +1,51 @@ -name: Metrics and Release - -on: - pull_request: - branches: - - dev - - master - - main - types: [closed] +name: Export de métricas +on: + pull_request: + branches: + - main + - develop + types: [ closed ] jobs: - release: - if: github.event.pull_request.merged == true - runs-on: "ubuntu-latest" + release: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'NOT RELEASE') == false + runs-on: "ubuntu-latest" + environment: actions + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install dotenv + run: pip install python-dotenv packaging + + - name: Cria arquivo .env + run: | + touch ./sonar_scripts/.env + echo GITHUB_TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./sonar_scripts/.env + echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./sonar_scripts/.env + echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./sonar_scripts/.env + echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./sonar_scripts/.env + echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./sonar_scripts/.env + echo REPO=${{ github.event.repository.name }} >> ./sonar_scripts/.env + echo REPO_DOC=${{ secrets.GIT_DOC_REPO }} >> ./sonar_scripts/.env - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Criar diretório + run: mkdir -p analytics-raw-data - - name: Cria arquivo .env - run: | - touch ./scripts/.env - echo TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./scripts/.env - echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./scripts/.env - echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./scripts/.env + - name: Coletar métricas no SonarCloud + run: python ./sonar_scripts/parser.py - - name: Gera release e envia métricas para repositório de DOC - run: | - cd scripts && yarn install && node release.js - git config --global user.email "${{secrets.GIT_USER_EMAIL}}" - git config --global user.name "${{secrets.GIT_USER_NAME}}" - git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/${{secrets.GIT_DOC_REPO}}" ${{secrets.GIT_DOC_REPO}} - mkdir -p ${{secrets.GIT_DOC_REPO}}/analytics-raw-data - cp -R analytics-raw-data/*.json ${{secrets.GIT_DOC_REPO}}/analytics-raw-data - cd ${{secrets.GIT_DOC_REPO}} - git add . - git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" - git push \ No newline at end of file + - name: Envia métricas para repo de Doc + run: | + git config --global user.email "${{secrets.GIT_USER_EMAIL}}" + git config --global user.name "${{secrets.GIT_USER_NAME}}" + git clone --single-branch --branch main "https://x-access-token:${{ secrets.API_TOKEN_GITHUB }}@github.com/fga-eps-mds/${{ secrets.GIT_DOC_REPO }}" doc + mkdir -p doc/analytics-raw-data + cp -R analytics-raw-data/*.json doc/analytics-raw-data + cd doc + git add . + git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" + git push \ No newline at end of file From 9ffe885202a3752a294f80b25599fa462e44a834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Corr=C3=AAa=20da=20Silva?= <78980992+dartmol203@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:19:59 -0300 Subject: [PATCH 3/3] FIX(#83): fix action to send metrics to doc repo Co-authored-by: gabrielm2q --- .github/workflows/metrics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 70e141d..c3cd98e 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - main - - develop + - dev types: [ closed ] jobs: