# https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: Trigger Build Farm

on:
  schedule:
    # Run at 09:00 UTC (02:00 PDT) everyday
    - cron: "0 9 * * *"
  repository_dispatch:

jobs:
  trigger_build_farm:
    name: Trigger Build Farm
    runs-on: ubuntu-latest
    steps:
      - name: Send request to dartsim/dart-build-farm to build dart7/main
        if: (github.event_name == 'schedule') && (github.event.action != 'Build Commit -- Done')
        run: |
          curl -X POST https://api.github.com/repos/dartsim/dart-build-farm/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.ACCESS_TOKEN }} \
          --data '{"event_type": "Build Commit", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref": "dart7/main" }}'
      - name: Recieve response from dartsim/dart-build-farm
        if: github.event.action == 'Build Commit -- Done'
        run: |
          echo "Build response received from '${{ github.event.client_payload.repository }}'" && \
          curl -X POST https://api.github.com/repos/dartsim/dart-build-farm/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.ACCESS_TOKEN }} \
          --data '{"event_type": "Build Commit -- Done", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'

# https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: Trigger Build Farm

on:
  schedule:
    # Run at 09:00 UTC (02:00 PDT) everyday
    - cron: "0 9 * * *"

jobs:
  trigger_build_farm:
    name: Trigger Build Farm
    runs-on: ubuntu-latest
    steps:
      - name: Trigger dartsim/dart-build-farm to build dart7/main
        run: |
          curl -X POST https://api.github.com/repos/dartsim/dart-build-farm/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.ACCESS_TOKEN }} \
          --data '{"event_type": "Build Commit", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref": "dart7/main" }}'

Remove receiving response from dart-build-farm
Remove receiving response from dart-build-farm