Skip to content

Cron job to check latest runtime for testing #271

Cron job to check latest runtime for testing

Cron job to check latest runtime for testing #271

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Cron job to check latest runtime for testing
on:
workflow_dispatch:
inputs:
feed:
description: 'Feed type'
required: true
default: 'unstable'
type: choice
options:
- lts
- stable
- beta
- unstable
schedule:
# At minute 30 past hour 13 and 22 UTC on every day-of-week from Monday through Friday.
- cron: '30 13,22 * * 1-5'
env:
FEED: ${{ github.event.inputs.feed || 'unstable' }}
permissions:
contents: write
jobs:
check_latest_runtime:
name: Check latest runtime
runs-on: ubuntu-20.04
outputs:
runtime: ${{ steps.sync.outputs.runtime }}
steps:
- uses: actions/checkout@v3
with:
ref: runtime_test_cron
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: echo "//registry.npmjs.org/:_authToken=${{secrets.BSCOTCH_NPM_READ_ANY}}" > .npmrc
- run: npm install @bscotch/runtime-test-manager
- id: sync
run: npx rtm sync -f ${{ env.FEED}}
order_test:
runs-on: 'ubuntu-latest'
if: ${{ needs.check_latest_runtime.outputs.runtime }}
needs: check_latest_runtime
name: Order test builds for ${{ needs.check_latest_runtime.outputs.runtime }}
steps:
- name: Use curl to order test builds at https://api.github.com/repos/bscotch/ganary/actions/workflows/build-and-test.yml/dispatche and fail the step if the http status is not 204
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}" \
https://api.github.com/repos/bscotch/ganary/actions/workflows/build-and-test.yml/dispatches \
-d '{"ref": "main", "inputs": {"runtime": "${{ needs.check_latest_runtime.outputs.runtime }}"}}' \
--fail-with-body -w "%{http_code}"