From 888e49538befc5e80d36189ef94654a554d54675 Mon Sep 17 00:00:00 2001 From: Stefano Verna Date: Wed, 6 Nov 2024 09:12:48 +0100 Subject: [PATCH] Add GH actions --- .github/workflows/code-quality.yml | 26 ++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/code-quality.yml diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 00000000..7fbfff39 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,26 @@ +name: Code Quality Checks + +on: + push: + pull_request: + +jobs: + quality: + name: Code Quality + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint diff --git a/package.json b/package.json index 5fcd4e8b..b3c77290 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "preview": "astro preview", "astro": "astro", "generate-schema": "dotenv -c -- bash -c 'gql.tada generate schema https://graphql.datocms.com --header \"X-Exclude-Invalid: true\" --header \"Authorization: $DATOCMS_API_TOKEN\"'", - "lint": "prettier --check .", + "lint": "astro check && prettier --check .", "format": "npx prettier . --write", "heroku-postbuild": "npm run build && npm run fastly:purge_all", "fastly:purge_all": "dotenv -c -- bash -c 'curl -i -X POST \"https://api.fastly.com/service/$FASTLY_SERVICE_ID/purge_all\" -H \"Fastly-Key: $FASTLY_KEY\" -H \"Accept: application/json\"'"