From 015698c15932c16b275de5ae7580cf71b5804627 Mon Sep 17 00:00:00 2001 From: Paulo Victor T Silva Date: Mon, 17 Jun 2024 12:08:30 -0300 Subject: [PATCH 1/8] feat: add dependencias entre workflows e ajust code-style7 --- .github/workflows/build.yml | 4 +++ .github/workflows/code-style.yml | 42 ++++++-------------------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0752a3b0..26a0a6e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,10 @@ on: pull_request: branches: - main + workflow_run: + workflows: ["Code Style"] + types: + - completed jobs: build: diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 2b731759..7ddaf497 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -7,6 +7,10 @@ on: pull_request: branches: - main + workflow_run: + workflows: ["Test"] + types: + - completed jobs: code-style: @@ -19,43 +23,11 @@ jobs: - name: Setup deps uses: ./.github/actions/install-deps - - name: Get all changed files - id: all-changed-files - uses: tj-actions/changed-files@v41 - with: - files: | - !pnpm-lock.yaml - - name: Run prettier in all files - if: steps.all-changed-files.outputs.any_changed == 'true' - env: - files: ${{ steps.all-changed-files.outputs.all_changed_files }} - run: pnpm exec prettier $files --check --ignore-unknown - - - name: Get specific changed files - id: changed-files - uses: tj-actions/changed-files@v41 - with: - files_yaml: | - code: - - '**.js' - - '**.ts' - - '**.tsx' - - '**.jsx' - - '**.mjs' - - '**.cjs' - style: - - '**.scss' + run: pnpm exec prettier . --check --ignore-unknown - name: Run stylelint in scss files - if: steps.changed-files.outputs.style_any_changed == 'true' - env: - files: ${{ steps.changed-files.outputs.style_all_changed_files }} - run: pnpm exec stylelint $files --allow-empty-input + run: pnpm exec stylelint . --allow-empty-input - name: Run eslint in code files - if: steps.changed-files.outputs.code_any_changed == 'true' - env: - files: ${{ steps.changed-files.outputs.code_all_changed_files }} - run: pnpm exec eslint $files --report-unused-disable-directives --max-warnings 0 --output-file eslint_report.json --format json - continue-on-error: true + run: pnpm exec eslint . --report-unused-disable-directives --max-warnings 0 From cd490ad2219249977f25a4a732dd2bb6c91c9df9 Mon Sep 17 00:00:00 2001 From: Paulo Victor T Silva Date: Mon, 17 Jun 2024 12:16:03 -0300 Subject: [PATCH 2/8] fix: removendo dependencias de workflows --- .github/workflows/build.yml | 4 ---- .github/workflows/code-style.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26a0a6e1..0752a3b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,6 @@ on: pull_request: branches: - main - workflow_run: - workflows: ["Code Style"] - types: - - completed jobs: build: diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 7ddaf497..15f6358d 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -7,10 +7,6 @@ on: pull_request: branches: - main - workflow_run: - workflows: ["Test"] - types: - - completed jobs: code-style: From 911aac298f1d058f1b59e2cf4651e2a53aa251c6 Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Tue, 27 Aug 2024 11:07:06 -0300 Subject: [PATCH 3/8] ajust workflows --- .github/workflows/autoAssigned.yml | 20 +++++--------------- .github/workflows/build.yml | 2 +- .github/workflows/code-style.yml | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/autoAssigned.yml b/.github/workflows/autoAssigned.yml index f388bcb2..fa4d29ef 100644 --- a/.github/workflows/autoAssigned.yml +++ b/.github/workflows/autoAssigned.yml @@ -1,21 +1,11 @@ -name: Auto-assign on comment +name: Base Actions on: issue_comment: types: [created] + pull_request: jobs: - auto-assign: - runs-on: ubuntu-latest - steps: - - name: Check for "EU QUERO!!!" comment - if: contains(github.event.comment.body, 'EU QUERO!!!') - run: | - # Extract the commenter's username - commenter=$(jq -r .comment.user.login $GITHUB_EVENT_PATH) - - # Add the commenter as an assignee to the issue using a Personal Access Token - echo "Assigning $commenter to the issue..." - curl -X POST -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ - -d "{\"assignees\": [\"$commenter\"]}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees" + assignes: + uses: devhatt/workflows/.github/workflows/auto-assign.yml@main + secrets: inherit diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0752a3b0..4be2186a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v3 - name: Setup deps - uses: ./.github/actions/install-deps + uses: devhatt/workflows/.github/actions/pnpm-setup@main - name: Build run: pnpm build diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 15f6358d..d462ec8d 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v3 - name: Setup deps - uses: ./.github/actions/install-deps + uses: devhatt/workflows/.github/actions/pnpm-setup@main - name: Run prettier in all files run: pnpm exec prettier . --check --ignore-unknown From b82011a1e5b664e073134cdd2d99585ca697ca72 Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Tue, 27 Aug 2024 11:11:18 -0300 Subject: [PATCH 4/8] add setup env script --- setup.mjs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 setup.mjs diff --git a/setup.mjs b/setup.mjs new file mode 100644 index 00000000..5398d1e4 --- /dev/null +++ b/setup.mjs @@ -0,0 +1,30 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const envFilePath = path.join(__dirname, '.env'); + +async function setupDotEnv() { + if (fs.existsSync(envFilePath)) { + console.log( + 'O .env já existe, se você deseja recriá-lo, exclua o arquivo e execute este script novamente.', + ); + return; + } + + try { + console.log('Baixando o .env do repositório...'); + const envData = await fetch( + 'https://raw.githubusercontent.com/devhatt/envs/main/petdex-front.env', + ).then((response) => response.text()); + fs.writeFileSync(envFilePath, envData); + console.log('O arquivo .env foi criado com sucesso!'); + } catch (error) { + console.error('Erro ao criar o arquivo .env:', error); + } +} + +setupDotEnv(); From d1891bb476f2bebead30a3ac6e6f576aec6b0e3f Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Tue, 27 Aug 2024 11:29:36 -0300 Subject: [PATCH 5/8] change name to base fowflows --- .github/workflows/{autoAssigned.yml => base-workflows.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{autoAssigned.yml => base-workflows.yml} (88%) diff --git a/.github/workflows/autoAssigned.yml b/.github/workflows/base-workflows.yml similarity index 88% rename from .github/workflows/autoAssigned.yml rename to .github/workflows/base-workflows.yml index fa4d29ef..df126b4a 100644 --- a/.github/workflows/autoAssigned.yml +++ b/.github/workflows/base-workflows.yml @@ -1,4 +1,4 @@ -name: Base Actions +name: Base workflows on: issue_comment: From 0ccfff0b5082f4d61a5cda1b2e009f7f54c4f979 Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Tue, 27 Aug 2024 16:25:10 -0300 Subject: [PATCH 6/8] add code owners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..fecdb124 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @devhatt/hatts From da49cdf2055b4b829e8776cd5e0ec71ce234b712 Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Tue, 27 Aug 2024 16:49:30 -0300 Subject: [PATCH 7/8] add code owners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fecdb124..e3a643d6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ * @devhatt/hatts +* @devhatt/petdex-frontend-administrators From 2f1b9af28ba5ac4bd674e99a411a6086edb9b4f5 Mon Sep 17 00:00:00 2001 From: Paulo V T Silva Date: Wed, 28 Aug 2024 10:12:24 -0300 Subject: [PATCH 8/8] ajust codewoners --- .github/CODEOWNERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e3a643d6..00b0c9dd 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -* @devhatt/hatts -* @devhatt/petdex-frontend-administrators +* @devhatt/hatts @devhatt/petdex-frontend-administrators