Skip to content

Commit

Permalink
Update validate-project-file.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sgbaird committed Apr 5, 2024
1 parent 7441ba5 commit 4c6316c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/validate-project-file.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Validate Project File Format

on:
# pull_request:
# paths:
# - '_projects/*.md'
push:
branches:
- main
paths:
- '_projects/*.md'
- '.github/workflows/validate-project-file.yml'
- 'test_validate_format.py'
pull_request:
paths:
- '_projects/*.md'
- '.github/workflows/validate-project-file.yml'
- 'test_validate_format.py'

jobs:
validate:
Expand All @@ -26,7 +29,7 @@ jobs:
python-version: '3.x'

- name: Install Python dependencies
run: pip install requests pyyaml
run: pip install requests pyyaml pytest

- name: Get list of changed files for PR
if: github.event_name == 'pull_request'
Expand All @@ -47,8 +50,7 @@ jobs:
run: |
echo "${{ steps.files.outputs.result }}" | while read file; do
if [[ "$file" == _projects/*.md ]]; then
python validate_format.py "$file"
if [ $? -ne 0 ]; then
if ! python validate_format.py "$file"; then
echo "Validation failed for $file"
exit 1
fi
Expand All @@ -60,8 +62,7 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
find _projects -name '*.md' | while read file; do
python validate_format.py "$file"
if [ $? -ne 0 ]; then
if ! python validate_format.py "$file"; then
echo "Validation failed for $file"
exit 1
fi
Expand Down

0 comments on commit 4c6316c

Please sign in to comment.