diff --git a/.circleci/config.yml b/.circleci/config.yml index b83d3c54c9..bec24753a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,7 @@ jobs: key: v0-blog-yarn-cache-{{ checksum "yarn.lock" }} paths: - ./node_modules - - run: yarn test + - run: yarn lint workflows: version: 2 build_and_test: diff --git a/.github/workflows/check-a11y-of-changed-content.yaml b/.github/workflows/check-a11y-of-changed-content.yaml index beab125321..3f52b5a01d 100644 --- a/.github/workflows/check-a11y-of-changed-content.yaml +++ b/.github/workflows/check-a11y-of-changed-content.yaml @@ -2,7 +2,9 @@ name: Check accessibility of changed content on: workflow_dispatch: - pull_request: + pull_request_target: + types: + - opened permissions: contents: read diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000000..046271140d --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,29 @@ +name: Lint Posts + +on: + push: + branches: + - '**' # Runs on pushes to all branches + pull_request: + branches: + - 'gh-pages' # Runs when a PR targets the gh-pages branch + +jobs: + lint-posts: + runs-on: "ubuntu-latest" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: npm + - name: Run install + uses: borales/actions-yarn@v5.0.0 + with: + cmd: install + - name: Run lint + uses: borales/actions-yarn@v5.0.0 + with: + cmd: lint diff --git a/package.json b/package.json index 1544b1c22f..208a8d31e0 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "url": "https://github.com/ScottLogic/blog/issues" }, "scripts": { - "test": "node lintPosts.js", + "lint": "node lintPosts.js", "compute-embeddings": "node scripts/generate-related/compute-embeddings.js", "generate-related": "node scripts/generate-related/blog-metadata.js", "remove-unused-images": "node scripts/images/remove-images.js",