Skip to content

Organization for November Plugfest #713

Organization for November Plugfest

Organization for November Plugfest #713

Workflow file for this run

name: Validation
on:
- pull_request
jobs:
validate-tds:
name: Validate TDs
runs-on: ubuntu-latest
steps:
- name: Checkout wot-testing
uses: actions/checkout@v2
- name: Checkout thingweb-playground
uses: actions/checkout@v2
with:
repository: thingweb/thingweb-playground
path: thingweb-playground
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '15'
- name: Use lerna
run: npm install -g [email protected]
- name: Bootstrap
working-directory: thingweb-playground
run: lerna bootstrap --no-ci
- name: Run validation script on all new matching files
env:
VALIDATION_SCRIPT: thingweb-playground/packages/cli/index.js
PATTERN: "*.td.jsonld"
run: |
# Get the list of changed files
url="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
changed_files=$(curl -s -X GET -G $url | jq -r '.[] | if .status!="removed" then .filename else empty end')
exit_code=0
for file in $changed_files; do
echo "===================="
# Check the file extension
if [[ $file == $PATTERN ]]; then
echo 'Validating' $file '...'
result=$(node $VALIDATION_SCRIPT -i $file -d)
if [[ $result == *"'failed'"* ]]; then
echo "$result"
echo '::error::Validation failed ✗'
exit_code=1
else
echo "$result"
echo 'Validation passed ✓'
fi
else
echo 'Skipped' $file
fi
done
exit $exit_code