From 9e2ae1199c9d652b2c6cc9ee781bf5de075d44d8 Mon Sep 17 00:00:00 2001 From: Dave Ogle Date: Thu, 21 Nov 2024 09:49:35 +0000 Subject: [PATCH 1/3] add job to lint posts on push --- .circleci/config.yml | 2 +- .../check-a11y-of-changed-content.yaml | 2 +- .github/workflows/lint.yaml | 29 +++++++++++++++++++ package.json | 2 +- 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/lint.yaml 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..217c8a4786 100644 --- a/.github/workflows/check-a11y-of-changed-content.yaml +++ b/.github/workflows/check-a11y-of-changed-content.yaml @@ -1,8 +1,8 @@ name: Check accessibility of changed content on: - workflow_dispatch: pull_request: + types: [opened, synchronize, reopened] 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", From bf969b3413893128286365989650b11247ea8078 Mon Sep 17 00:00:00 2001 From: Dave Ogle Date: Wed, 27 Nov 2024 08:42:20 +0000 Subject: [PATCH 2/3] PR feedback --- .../workflows/check-a11y-of-changed-content.yaml | 1 - .github/workflows/lint.yaml | 13 ++----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check-a11y-of-changed-content.yaml b/.github/workflows/check-a11y-of-changed-content.yaml index 217c8a4786..520c2d04bc 100644 --- a/.github/workflows/check-a11y-of-changed-content.yaml +++ b/.github/workflows/check-a11y-of-changed-content.yaml @@ -2,7 +2,6 @@ name: Check accessibility of changed content on: pull_request: - types: [opened, synchronize, reopened] permissions: contents: read diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 046271140d..4d5bc3c8e3 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,9 +1,6 @@ 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 @@ -19,11 +16,5 @@ jobs: 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 + - run: npm ci + - run: npm run lint From 20322e3ae4a2a280092b2b805282ff38c0bdaf38 Mon Sep 17 00:00:00 2001 From: Dave Ogle Date: Thu, 28 Nov 2024 09:18:40 +0000 Subject: [PATCH 3/3] remove circleci config --- .circleci/config.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index bec24753a7..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 2 -jobs: - spellcheck: - docker: - - image: circleci/node:10.9-browsers - steps: - - checkout - - restore_cache: - key: v0-blog-yarn-cache-{{ checksum "yarn.lock" }} - - run: - command: | - yarn install - - save_cache: - key: v0-blog-yarn-cache-{{ checksum "yarn.lock" }} - paths: - - ./node_modules - - run: yarn lint -workflows: - version: 2 - build_and_test: - jobs: - - spellcheck \ No newline at end of file