-
Notifications
You must be signed in to change notification settings - Fork 340
59 lines (59 loc) · 2.16 KB
/
trigger-external.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Trigger external examples & test
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to pass with repository_dispatch ex: "v0.15.1"'
type: string
required: true
release:
types: [published]
pull_request_target:
branches: [main]
push:
branches: [main]
jobs:
push:
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
runs-on: ubuntu-latest
strategy:
matrix:
repos: [cml-playground]
steps:
- name: Trigger external actions
run: |
curl --silent --show-error --request POST \
--header "Authorization: token ${{ secrets.TEST_GITHUB_TOKEN }}" \
--header "Accept: application/vnd.github.v3+json" \
--url "https://api.github.com/repos/iterative/${{ matrix.repos }}/dispatches" \
--data '{"event_type":"push", "client_payload": {"branch":"main"}}'
pr:
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
strategy:
matrix:
repos: [cml-playground]
steps:
- name: Trigger external actions
run: |
curl --silent --show-error --request POST \
--header "Authorization: token ${{ secrets.TEST_GITHUB_TOKEN }}" \
--header "Accept: application/vnd.github.v3+json" \
--url "https://api.github.com/repos/iterative/${{ matrix.repos }}/dispatches" \
--data '{"event_type":"pr", "client_payload": {"branch":"${{ github.ref_name }}"}}'
trigger:
if:
${{ github.event_name == 'release' || github.event_name ==
'workflow_dispatch' }}
runs-on: ubuntu-latest
strategy:
matrix:
repos: [cml-playground]
steps:
- name: Trigger external actions
run: |
curl --silent --show-error --request POST \
--header "Authorization: token ${{ secrets.TEST_GITHUB_TOKEN }}" \
--header "Accept: application/vnd.github.v3+json" \
--url "https://api.github.com/repos/iterative/${{ matrix.repos }}/dispatches" \
--data '{"event_type":"new-cml", "client_payload": {"tag":"${{ github.event.release.tag_name || github.event.inputs.tag }}"}}'