Skip to content

Commit

Permalink
feat: add code style pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarogfn committed Jan 17, 2024
1 parent 967fd36 commit 1a4ac9a
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 11 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Code Style

on:
pull_request:
branches: ['main']

jobs:
code-style:
runs-on: ubuntu-latest
name: code-style
steps:
- name: Code Checkout
uses: actions/checkout@v3

- 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'
- '**.vue'
- 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

- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'eslint_report.json'
- name: Upload ESLint report
uses: actions/upload-artifact@v1
with:
name: eslint_report.json
path: eslint_report.json
36 changes: 26 additions & 10 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@ export default defineNuxtConfig({
generate: {},
modules: [
["@nuxtjs/sitemap", {}],
['nuxt-gtag', {
gtag: {
id: 'UA-XXXXXXXX-X'
}
}],
["@nuxtjs/i18n", {
vueI18n: './i18n'


}],
[
"nuxt-gtag",
{
gtag: {
id: "UA-XXXXXXXX-X",
},
},
],
[
"@nuxtjs/i18n",
{
locales: ['pt'],
vueI18n: "./i18n"
},
],
[
"@nuxtjs/google-fonts",
{
families: {
"Space+Mono": true,
},
googleFonts: {
outputDir: "assets",
},
},
],
],
nitro: {
prerender: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@eslint/eslintrc": "3.0.0",
"@eslint/js": "8.56.0",
"@nuxt/eslint-config": "0.2.0",
"@nuxtjs/google-fonts": "3.1.3",
"@nuxtjs/i18n": "8.0.0",
"@types/eslint__eslintrc": "2.1.1",
"@typescript-eslint/eslint-plugin": "6.18.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
h1 {
font-size: 2.5rem;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: "Space Mono", sans-serif;
font-weight: bold;
color: white;
}
Expand Down
23 changes: 23 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a4ac9a

Please sign in to comment.