forked from actions/runner-images
-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (40 loc) · 1.26 KB
/
trigger-ubuntu-win-build.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
name: Trigger Build workflow
on:
workflow_call:
inputs:
image_type:
required: true
type: string
defaults:
run:
shell: pwsh
jobs:
trigger-workflow:
runs-on: ubuntu-latest
steps:
- name: Trigger Build workflow
env:
CI_PR_TOKEN: ${{ secrets.CI_PR_TOKEN }}
PR_TITLE: ${{ github.event.pull_request.title }}
CI_PR: ${{ secrets.CI_REPO }}
run: |
$headers = @{
Authorization="Bearer $env:CI_PR_TOKEN"
}
# Private repository for builds
$apiRepoUrl = "https://api.github.com/repos/$env:CI_PR"
$eventType = "trigger-${{ inputs.image_type }}-build"
$body = @{
event_type = $eventType;
client_payload = @{
pr_title = "$env:PR_TITLE"
custom_repo = "${{ github.event.pull_request.head.repo.full_name }}"
custom_repo_commit_hash = "${{ github.event.pull_request.head.sha }}"
}
}
$bodyString = $body | ConvertTo-Json
try {
Invoke-WebRequest -Uri "$apiRepoUrl/dispatches" -Method Post -Headers $headers -Body $bodyString | Out-Null
} catch {
throw "$($_.exception[0].message)"
}