-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 2.14 KB
/
metrics.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Export de métricas
on:
pull_request:
branches:
- main
- develop
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 ./sonar_scripts/.env
echo GITHUB_TOKEN=${{ secrets.LIVRO_LIVRE_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.LIVRO_LIVRE_REPO_DOC }} >> ./sonar_scripts/.env
- name: Criar diretório
run: mkdir -p analytics-raw-data
- name: Coletar métricas no SonarCloud
run: python ./sonar_scripts/parser.py
- name: Envia métricas para repo de Docs
run: |
git config --global user.email "${{secrets.LIVRO_LIVRE_USER_EMAIL}}"
git config --global user.name "${{secrets.LIVRO_LIVRE_USER_NAME}}"
git clone --single-branch --branch main "https://x-access-token:${{ secrets.LIVRO_LIVRE_API_TOKEN_GITHUB }}@github.com/fga-eps-mds/${{ secrets.LIVRO_LIVRE_REPO_DOC }}" 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