Skip to content

Commit

Permalink
Update check_yaml_name.yml (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
raller1028 authored Aug 4, 2023
1 parent 673d7da commit 3723c83
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions .github/workflows/check_yaml_name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,13 @@ jobs:
- name: Checkout
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
id: check_name
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
run: |
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_-]."
exit 1
else
echo "name:${{ steps.check_name.outputs.result }}"
fi
find . -type f \( -name "docker-compose.yaml" -or -name "docker-compose.yml" \) | while read -r file; do
if ! grep -qP '^name:\s[a-z0-9_-]*$' "$file"; 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"
exit 1
fi
done

0 comments on commit 3723c83

Please sign in to comment.