Update check_yaml_name.yml (#241)
This commit is contained in:
parent
673d7da1e7
commit
3723c83938
|
@ -12,23 +12,13 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Find YAML files
|
|
||||||
id: find_yaml
|
|
||||||
run: |
|
|
||||||
yaml_files=$(find . -name "*.yaml" -o -name "*.yml" | tr '\n' ' ')
|
|
||||||
echo "::set-output name=yaml_files::$yaml_files"
|
|
||||||
|
|
||||||
- name: Check name field in YAML files
|
- name: Check name field in YAML files
|
||||||
id: check_name
|
id: check_name
|
||||||
run: |
|
run: |
|
||||||
result=$(grep -oP '^name:\s(?!.*[A-Z])[a-z0-9_-]*$' ${{ steps.find_yaml.outputs.yaml_files }})
|
|
||||||
echo "::set-output name=result::$result"
|
|
||||||
|
|
||||||
- name: Check result
|
find . -type f \( -name "docker-compose.yaml" -or -name "docker-compose.yml" \) | while read -r file; do
|
||||||
run: |
|
if ! grep -qP '^name:\s[a-z0-9_-]*$' "$file"; then
|
||||||
if [ -z "${{ steps.check_name.outputs.result }}" ]; then
|
echo "There is a problem with the value of name in the submitted yaml, please make sure the value is in the range [a-z0-9_-]. And error file name:$file"
|
||||||
echo "There is a problem with the value of name in the submitted yaml, please make sure the value is in the range [a-z0-9_-]."
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
else
|
done
|
||||||
echo "name:${{ steps.check_name.outputs.result }}"
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue