From 7f68c87bc2744caf6281c30856f32ad1014536e4 Mon Sep 17 00:00:00 2001 From: Nicolas MASSART Date: Mon, 4 Jul 2022 16:22:21 +0200 Subject: [PATCH] Add case check (#21) * Add case check update checkout action version to v3 * update code owners to docops team * update action to local path * fix input --- .github/workflows/case.yml | 17 ++++++++++++++ .github/workflows/docker.yml | 2 +- .github/workflows/pr_preview_delete.yml | 4 ++-- CODEOWNERS | 6 ++--- actions/tests/case/action.yml | 31 +++++++++++++++++++++++++ actions/tests/links/action.yml | 2 +- actions/tests/lint/action.yml | 2 +- 7 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/case.yml create mode 100644 actions/tests/case/action.yml diff --git a/.github/workflows/case.yml b/.github/workflows/case.yml new file mode 100644 index 0000000..62ce3bd --- /dev/null +++ b/.github/workflows/case.yml @@ -0,0 +1,17 @@ +--- +name: Check file name case + +on: [pull_request] + +jobs: + check: + name: Check file name case + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v3 + - name: Check file name case + uses: ./actions/tests/case + with: + DOC_DIR: tests/docs diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1d04915..90b90c9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,7 @@ jobs: contents: read steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set image ID and TAG shell: sh diff --git a/.github/workflows/pr_preview_delete.yml b/.github/workflows/pr_preview_delete.yml index f9bf4d9..b4044b9 100644 --- a/.github/workflows/pr_preview_delete.yml +++ b/.github/workflows/pr_preview_delete.yml @@ -15,12 +15,12 @@ jobs: steps: - name: 'checkout code from repos' - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: pr-preview - name: Checkout actions - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: actions diff --git a/CODEOWNERS b/CODEOWNERS index cb402bf..88ac155 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,6 +1,4 @@ # SPDX-License-Identifier: Apache-2.0 -# Docs team -* @ConsenSys/protocol-pliny -.github/ @NicolasMassart -/actions/ @NicolasMassart +# DocOps team +* @ConsenSys/consensys-docops diff --git a/actions/tests/case/action.yml b/actions/tests/case/action.yml new file mode 100644 index 0000000..a1ba996 --- /dev/null +++ b/actions/tests/case/action.yml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: Apache-2.0 +--- +name: 'Check pages file name case' +description: 'Composite action to check case of files in doc' + +inputs: + DOC_DIR: + description: 'doc directory path from project root' + required: false + default: docs + +runs: + using: "composite" + steps: + - name: Check pages file name case + shell: sh + run: | + echo "Testing file case in ${{ inputs.DOC_DIR }}." + passed=true + for filename in `find ${{ inputs.DOC_DIR }} -name "*.md" | ( ! grep -P -v "^[[:lower:][:digit:]\/\-_]+\.md$" )` + do + echo "$filename" + echo "::error file=$filename ::File path must be only lowercase letters, digits, - (dash) and _ (underscore)" + passed=false + done; + if [ "$passed" = false ] ; then + echo "::error ::Some files path are incorrect. Check error annotations in the pull request." + echo "Correct example: my-folder/my-file-name_new2.md" + echo "Wrong example: My-Folder/MyFile-NAME.old.md" + exit 1 + fi diff --git a/actions/tests/links/action.yml b/actions/tests/links/action.yml index 4fa11ca..f083017 100644 --- a/actions/tests/links/action.yml +++ b/actions/tests/links/action.yml @@ -7,7 +7,7 @@ runs: using: "composite" steps: - name: Checkout tools repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: ConsenSys/doctools.action-builder path: .doctools.action-builder diff --git a/actions/tests/lint/action.yml b/actions/tests/lint/action.yml index 1c00631..ecf9885 100644 --- a/actions/tests/lint/action.yml +++ b/actions/tests/lint/action.yml @@ -12,7 +12,7 @@ runs: using: "composite" steps: - name: Checkout tools repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: ConsenSys/doctools.action-builder path: .doctools.action-builder