Skip to content

Commit dcd28bc

Browse files
authored
Add check job
1 parent a2157a0 commit dcd28bc

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Diff for: .github/workflows/jekyll-gh-pages.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,35 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24-
# Build job
24+
check:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
- name: Test files
30+
run: |
31+
for s in $(find -type f -name "*.ics" -print); do
32+
echo "::group::Test file $s";
33+
echo "Make http request"
34+
echo "::debug::$response"
35+
response=$(curl -sS -F "jform[task]=validate" -F "jform[ical_file]=@$s" "https://icalendar.org/validator.html?json=1")
36+
error_count=$(echo "$response" | jq '.totals.errors')
37+
warning_count=$(echo "$response" | jq '.totals.warnings')
38+
echo "File has $error_count errors and $warning_count warnings."
39+
if [ "$error_count" -gt "0" ]; then
40+
echo "::error title=Error found::$(echo "$response" | jq -r '.errors | map(.message) | join("\n")')"
41+
exit 1
42+
fi
43+
if [ "$warning_count" -gt "0" ]; then
44+
echo "::warning title=Warning found::$(echo "$response" | jq -r '.warnings | map(.message) | join("\n")')"
45+
exit 2
46+
fi
47+
echo "::endgroup::"
48+
done
49+
2550
build:
2651
runs-on: ubuntu-latest
52+
needs: check
2753
steps:
2854
- name: Checkout
2955
uses: actions/checkout@v3

0 commit comments

Comments
 (0)