Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Add case check (#21)
Browse files Browse the repository at this point in the history
* Add case check

update checkout action version to v3

* update code owners to docops team

* update action to local path

* fix input
  • Loading branch information
NicolasMassart authored Jul 4, 2022
1 parent 7b574bf commit 7f68c87
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/case.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set image ID and TAG
shell: sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr_preview_delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

# Docs team
* @ConsenSys/protocol-pliny
.github/ @NicolasMassart
/actions/ @NicolasMassart
# DocOps team
* @ConsenSys/consensys-docops
31 changes: 31 additions & 0 deletions actions/tests/case/action.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion actions/tests/links/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion actions/tests/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7f68c87

Please sign in to comment.