Skip to content

Merge pull request #29 from fga-eps-mds/fix/workflow-release #50

Merge pull request #29 from fga-eps-mds/fix/workflow-release

Merge pull request #29 from fga-eps-mds/fix/workflow-release #50

Workflow file for this run

name: Export de métricas
on:
push:
branches:
- master
- devel
tags:
- "v*"
pull_request:
branches:
- master
- devel
types: [ closed ]
jobs:
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 pandas
- name: Cria arquivo .env
run: |
touch ./metrics/.env
echo GITHUB_TOKEN=${{ secrets.PERSONAL_TOKEN }} >> ./metrics/.env
echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./metrics/.env
echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./metrics/.env
echo RELEASE_FIX=${{ contains(github.event.pull_request.labels.*.name, 'FIX RELEASE') }} >> ./metrics/.env
echo DEVELOP=${{ contains(github.event.pull_request.labels.*.name, 'DEVELOP') }} >> ./metrics/.env
echo REPO=${{ github.event.repository.name }} >> ./metrics/.env
- name: Criar diretório
run: mkdir -p analytics-raw-data
- name: Coletar métricas no SonarCloud
run: python metrics/sonar-metrics.py ${{ github.event.repository.name }} ${{ github.ref_name }}
- name: Envia métricas para repo de Doc
run: |
git config --global user.email "${{secrets.GIT_EMAIL}}"
git config --global user.name "${{secrets.GIT_USER}}"
git clone --single-branch --branch main "https://x-access-token:${{secrets.PERSONAL_TOKEN}}@github.com/fga-eps-mds/2024.2-SENTINELA-DOC" doc
mkdir -p doc/analytics-raw-data
cp -R fga-eps-mds*.json doc/analytics-raw-data
cd doc
git add .
git commit -m "Métricas SonarCloud - ${{ github.event.repository.name }} ${{ github.ref_name }}"
git push