name: JSON validation on: pull_request jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Check apps.json run: | jq apps.json - name: Check all working apps have consistent app id / app url run: | for LINE in $(cat apps.json | jq -r 'to_entries[] | select ( .value.state=="working" ) | "\(.key)|\(.value.url)"') do APP=$(echo $LINE | awk -F'|' '{print $1}') URL_END=$(echo $LINE | awk -F'/' '{print $NF}') [ "$APP" == "$(echo $APP | tr [A-Z] [a-z])" ] || echo "$APP : app id should be lowercase" >&2 [ "$URL_END" == "${APP}_ynh" ] || echo "$APP : the url should end with ${APP}_ynh" >&2 done - name: Check all working apps have a category run: | jq -e -r '.[] | select ( .state=="working" ) | select ( has("category") | not )' apps.json [ $? -eq 4 ] || echo "Some working applications don't have their category defined ?" >&2