Skip to content

SlideRule Test Report #6

SlideRule Test Report

SlideRule Test Report #6

name: SlideRule Test Report
on:
schedule:
- cron: '0 7 * * *' # every night at 2 a.m. EST
jobs:
call-api:
runs-on: ubuntu-latest
steps:
- name: Query SlideRule Test Report
env:
SLIDERULE_GITHUB_TOKEN: ${{ secrets.SESSION_PAT }}
run: |
set -euo pipeline # stop workflow if curl exits non-zero
JWT=$(curl -fsS https://login.slideruleearth.io/auth/github/pat -d "{\"pat\":\"$SLIDERULE_GITHUB_TOKEN\"}" | jq -r '.token')
REPORT=$(curl -fsS -X POST -H "Authorization: Bearer $JWT" https://provisioner.slideruleearth.io/report/tests)
REPORT_EPOCH=$(date -d "$(echo $REPORT | jq -r '.report.date')" +%s)
TODAY_EPOCH=$(date -d "$(date +%F)" +%s)
jq -e '.report.status == true' <<< "$REPORT" > /dev/null # check success
(( REPORT_EPOCH >= TODAY_EPOCH )) # check test ran today