Skip to content

Dispatch PyTorch events #13

Dispatch PyTorch events

Dispatch PyTorch events #13

name: 'Dispatch PyTorch events'
on:
schedule:
- cron: '0 12 * * *'
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/dispatch-event.yml'
- '.github/workflows/redispatch-event.yml'
- '.github/actions/list-pr/**'
- '!**/*.md'
workflow_dispatch:
inputs:
labels:
required: false
type: string
default: 'module: PrivateUse1'
description: 'The labels on pull requests'
hours:
required: false
type: number
default: 24
description: 'Pull requests created within this many hours will be listed'
limit:
required: false
type: number
default: -1
description: 'How many pull requests will be listed'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
list-pr:
name: List PyTorch pull requests
runs-on: ubuntu-latest
outputs:
prs: ${{ steps.list-pr.outputs.prs }}
steps:
- name: Checkout
uses: actions/checkout@v4
# List PRs created in the past 24 hours
- name: List PyTorch PRs
id: list-pr
uses: ./.github/actions/list-pr
with:
token: ${{ secrets.COSDT_BOT_TOKEN }}
owner: pytorch
repository: pytorch
labels: "${{ github.event.inputs.labels || 'module: PrivateUse1' }}"
hours: ${{ github.event.inputs.hours || '24' }}
dispatch-pr:
if: ${{ needs.list-pr.outputs.prs != '[]' }}
name: 'Dispatch PR event - #${{ matrix.data.pull_request.number }}'
runs-on: ubuntu-latest
needs:
- list-pr
strategy:
fail-fast: false
max-parallel: 1
matrix:
data: ${{ fromJSON(needs.list-pr.outputs.prs) }}
steps:
- name: Dispatch PR event to the out-of-tree test infra
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.COSDT_BOT_TOKEN }}
repository: pytorch-fdn/oota
event-type: pytorch-pr-event
client-payload: ${{ toJSON(matrix.data) }}