From fc295bcc057818aab78b897e9076b8143e43d66c Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Tue, 22 Jun 2021 09:23:57 +0200 Subject: [PATCH 1/5] Add Prettier Autofix Workflow for Markdown Signed-off-by: Philipp Hugenroth --- .github/workflows/prettify.yml | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/prettify.yml diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml new file mode 100644 index 0000000000..fd6c403bd2 --- /dev/null +++ b/.github/workflows/prettify.yml @@ -0,0 +1,55 @@ +name: Prettier + +on: + push: + branches: + - master + +jobs: + autofix-markdown: + name: Autofix Markdown files using Prettier + runs-ons: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # Fetch changes to previous commit - required for 'only_changed' in Prettier action + fetch-depth: 0 + + # Beginning of yarn setup, keep in sync between all workflows, see ci.yml + - name: use node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ # Needed for auth + - name: cache all node_modules + id: cache-modules + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-v${{ matrix.node-version }}-node_modules-${{ hashFiles('yarn.lock', '**/package.json') }} + - name: find location of global yarn cache + id: yarn-cache + if: steps.cache-modules.outputs.cache-hit != 'true' + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: cache global yarn cache + uses: actions/cache@v2 + if: steps.cache-modules.outputs.cache-hit != 'true' + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: yarn install + run: yarn install --frozen-lockfile + # End of yarn setup + + - name: Run Prettier + uses: creyD/prettier_action@v3.1 + with: + # Modifies commit only if prettier autofixed a Markdown file + prettier_options: --config docs/prettier.config.js --write docs/**/*.md + only_changed: true + commit_message: "Autofix Markdown files using Prettier" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From ffddba6f42fa7bb4dce3be77cee6a7b3304b32a7 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Tue, 22 Jun 2021 10:37:00 +0200 Subject: [PATCH 2/5] Add autofix for root Markdown Signed-off-by: Philipp Hugenroth --- .github/workflows/prettify.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml index fd6c403bd2..fe8452e6df 100644 --- a/.github/workflows/prettify.yml +++ b/.github/workflows/prettify.yml @@ -43,12 +43,22 @@ jobs: run: yarn install --frozen-lockfile # End of yarn setup - - name: Run Prettier + - name: Run Prettier on docs uses: creyD/prettier_action@v3.1 with: # Modifies commit only if prettier autofixed a Markdown file prettier_options: --config docs/prettier.config.js --write docs/**/*.md only_changed: true + commit_message: "Autofix documentation Markdown files using Prettier" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run Prettier on root + uses: creyD/prettier_action@v3.1 + with: + # Modifies commit only if prettier autofixed a Markdown file + prettier_options: --write *.md + only_changed: true commit_message: "Autofix Markdown files using Prettier" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c599fd104ea22ed896a65c8ba3712a6318d232b3 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Tue, 22 Jun 2021 10:45:45 +0200 Subject: [PATCH 3/5] Run prettier on prettier.yml,... Signed-off-by: Philipp Hugenroth --- .github/workflows/prettify.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml index fe8452e6df..36d3275f66 100644 --- a/.github/workflows/prettify.yml +++ b/.github/workflows/prettify.yml @@ -49,7 +49,7 @@ jobs: # Modifies commit only if prettier autofixed a Markdown file prettier_options: --config docs/prettier.config.js --write docs/**/*.md only_changed: true - commit_message: "Autofix documentation Markdown files using Prettier" + commit_message: 'Autofix documentation Markdown files using Prettier' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -59,7 +59,6 @@ jobs: # Modifies commit only if prettier autofixed a Markdown file prettier_options: --write *.md only_changed: true - commit_message: "Autofix Markdown files using Prettier" + commit_message: 'Autofix Markdown files using Prettier' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - From efabbe3f02f17378ba85560969b2d0fcb466e945 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Mon, 9 Aug 2021 13:37:11 +0200 Subject: [PATCH 4/5] Adjust workflows to ignore errors & autoformat ADOPTERS.md using prettier Signed-off-by: Philipp Hugenroth --- .github/workflows/ci.yml | 2 +- .github/workflows/prettify.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f013d10f8..8361654038 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: run: node scripts/verify-links.js - name: prettier - run: yarn prettier:check + run: yarn prettier:check '!ADOPTERS.md' - name: lock run: yarn lock:check diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml index 36d3275f66..fbf2519513 100644 --- a/.github/workflows/prettify.yml +++ b/.github/workflows/prettify.yml @@ -46,8 +46,8 @@ jobs: - name: Run Prettier on docs uses: creyD/prettier_action@v3.1 with: - # Modifies commit only if prettier autofixed a Markdown file - prettier_options: --config docs/prettier.config.js --write docs/**/*.md + # Modifies commit only if prettier autofixed the ADOPTERS.md + prettier_options: --config docs/prettier.config.js --write ADOPTERS.md only_changed: true commit_message: 'Autofix documentation Markdown files using Prettier' env: From e797e46368c706bc61535b5b2c2680953b640978 Mon Sep 17 00:00:00 2001 From: Philipp Hugenroth Date: Wed, 11 Aug 2021 10:40:44 +0200 Subject: [PATCH 5/5] Fix workflow Signed-off-by: Philipp Hugenroth --- .github/workflows/prettify.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/prettify.yml b/.github/workflows/prettify.yml index fbf2519513..4a34ff0c88 100644 --- a/.github/workflows/prettify.yml +++ b/.github/workflows/prettify.yml @@ -8,7 +8,7 @@ on: jobs: autofix-markdown: name: Autofix Markdown files using Prettier - runs-ons: ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: @@ -43,22 +43,12 @@ jobs: run: yarn install --frozen-lockfile # End of yarn setup - - name: Run Prettier on docs + - name: Run Prettier on ADOPTERS.md uses: creyD/prettier_action@v3.1 with: # Modifies commit only if prettier autofixed the ADOPTERS.md prettier_options: --config docs/prettier.config.js --write ADOPTERS.md only_changed: true - commit_message: 'Autofix documentation Markdown files using Prettier' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run Prettier on root - uses: creyD/prettier_action@v3.1 - with: - # Modifies commit only if prettier autofixed a Markdown file - prettier_options: --write *.md - only_changed: true - commit_message: 'Autofix Markdown files using Prettier' + commit_message: 'Autofix ADOPTERS.md using Prettier' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}