-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.69 KB
/
strain-repo-dispatch.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
name: Strain Repo Dispatch 📜
on:
workflow_call:
inputs:
STRAIN_PROPERTY:
description: Strain property value
required: true
type: string
STRAIN_PATH:
description: Path for the strain
required: true
type: string
secrets:
ROBONEXT_PAT:
description: Personal access token for repository dispatch
required: true
jobs:
strain-dispatch:
runs-on: ubuntu-latest
steps:
- name: Manipulate strain property if necessary
run: |
echo "STRAIN_PROPERTY=${{ inputs.STRAIN_PROPERTY }}" >> $GITHUB_ENV
- name: Strain Repository Dispatch
if: |
github.event.action == 'opened' ||
github.event.action == 'synchronize' ||
(github.event.action == 'closed' && github.event.pull_request.merged)
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.ROBONEXT_PAT }}
repository: nelc/edx-platform-strains
event-type: strain-update-pr
client-payload: |
{
"repo": "${{ github.repository }}",
"sha": "${{ github.event.pull_request.head.sha }}",
"head_ref": "${{ github.head_ref }}",
"base_ref": "${{ github.base_ref }}",
"strain_property": "${{ env.STRAIN_PROPERTY }}",
"strain_property_value": "${{ env.PROPERTY_VALUE }}",
"strain_path": "${{ inputs.STRAIN_PATH }}",
"pr_number": "${{ github.event.number }}",
"pr_action": "${{ github.event.action }}"
}
env:
PROPERTY_VALUE: ${{ github.event.pull_request.merged && github.base_ref || github.head_ref }}