Skip to content

feat: add thumbnail to samples #44

feat: add thumbnail to samples

feat: add thumbnail to samples #44

name: Sample Validation
on:
workflow_dispatch:
pull_request:
branches:
- dev
push:
branches:
- dev
jobs:
sample-validation:
runs-on: ubuntu-latest
steps:
- name: Checkout Pull Request
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout Branch
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
repository: ${{ github.repository }}
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Validate Sample Config
run: |
node validation-tool/validate-config.js .config/samples-config-v3.json
exit $?
- name: Sample Validation Tool
run: |
# This script runs the validation tool against all samples in the samples-config-v3.json file.
# External samples are excluded from the validation.
exceptions=("incoming-webhook-notification")
samples=`jq -r ".samples | .[] | select(has(\"downloadUrl\") | not) | .id" .config/samples-config-v3.json`
validationFailed="validation failed"
validationResult=true
while IFS= read -r line; do
if [[ ! ${exceptions[@]} =~ $line ]]
then
result=`node ./validation-tool/validator.cjs -p $line`
if grep -q "$validationFailed" <<< "$result"; then
printf "\nSample '$line' validation failed.\n"
echo "$result"
validationResult=false
fi
fi
done <<< "$samples"
if [ "$validationResult" = false ]; then
exit 1
fi