From 622a087203a0b261c0748b14d232af11cc50fa4d Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:33:04 +0100 Subject: [PATCH] ci: add overall prettier check to ci --- .github/workflows/main.yml | 9 ++++++--- CONTRIBUTING.md | 12 +++++++++--- package.json | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c48e442a..1fbdbe6bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,9 +20,12 @@ jobs: # https://github.com/actions/runner/blob/main/src/Misc/externals.sh node-version: 20.18.0 - run: npm ci - - run: npm run format - - run: npm run build - - run: npm run lint + # Core action code + - run: npm run format # Prettier formats core action code + - run: npm run build # builds core action code into dist/ + # All repo + - run: npm run lint # ESLint + - run: npm run format:all:check # Prettier formatting check release: runs-on: ubuntu-24.04 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab1cbb464..0df0b6e86 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ To contribute changes, follow these instructions in the order given below: 1. Clone the repository 1. Create a new branch with a meaningful name e.g. `fix/my-bug` based on the current `master` branch. 1. Make the necessary source code changes, including additions or changes to the [README.md](./README.md) documentation if parameters are added or affected. -1. Execute the following in the root directory of the cloned repository +1. Execute the following in the root directory of the cloned repository to install dependencies, then to format and build the action from the main source code elements (see above): ```bash npm install @@ -51,13 +51,19 @@ To contribute changes, follow these instructions in the order given below: npm run build ``` -1. If you have modified any Markdown documents (`*.md`) then execute +1. If you have modified any other files, such as examples, then execute: + + ```bash + npm run format:all + ``` + +1. If you have only modified Markdown documents (`*.md`), then you can alternatively execute the following to format only those documents: ```bash npm run format:markdown ``` -1. Commit the change. (If you are working on Microsoft Windows, see [Windows users](#windows-users) below.) +1. Commit any changes. (If you are working on Microsoft Windows, see [Windows users](#windows-users) below.) 1. Push to the repository. 1. If you are working in a fork, ensure actions are enabled. 1. Refer to [Manually running a workflow](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) to use this to test any particular workflow affected by your change. diff --git a/package.json b/package.json index 61f478ccc..51e0b6568 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "format": "prettier --write index.js src/ping.js action.yml", "format:markdown": "prettier --write \"**/*.md\"", "format:markdown:check": "prettier --check \"**/*.md\"", + "format:all": "prettier --write .", + "format:all:check": "prettier --check .", "lint": "eslint", "check:markdown-links": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check", "update:cypress": "./scripts/update-cypress-latest.sh",