Skip to content

Commit cdd433d

Browse files
authored
feat: add strains dispatcher workflow (#5)
1 parent 7243da7 commit cdd433d

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
A centralized spot for all your reusable GitHub Actions workflows and custom actions in the NELC organization. We aim to standardize CI/CD processes across multiple projects.
44

5+
## Available Actions & Workflows
6+
7+
| Name | Description | File Path |
8+
|------------------------------|----------------------------------------------------------------------|-----------------------------------------------------------------|
9+
| **Strain Repo Dispatch** | Kicks off strain updates whenever certain repository events happen. | [strain-repo-dispatch/action.yml](strain-repo-dispatch/action.yml) |
510

611
## Using Actions from Organization Repositories
712

strain-repo-dispatch/action.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Strain Repo Dispatch 📜
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
STRAIN_PROPERTY:
7+
description: Strain property value
8+
required: true
9+
type: string
10+
STRAIN_PATH:
11+
description: Path for the strain
12+
required: true
13+
type: string
14+
secrets:
15+
ROBONEXT_PAT:
16+
description: Personal access token for repository dispatch
17+
required: true
18+
19+
jobs:
20+
strain-dispatch:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Manipulate strain property if necessary
24+
run: |
25+
echo "STRAIN_PROPERTY=${{ inputs.STRAIN_PROPERTY }}" >> $GITHUB_ENV
26+
27+
- name: Strain Repository Dispatch
28+
if: |
29+
github.event.action == 'opened' ||
30+
github.event.action == 'synchronize' ||
31+
(github.event.action == 'closed' && github.event.pull_request.merged)
32+
uses: peter-evans/repository-dispatch@v3
33+
with:
34+
token: ${{ secrets.ROBONEXT_PAT }}
35+
repository: nelc/edx-platform-strains
36+
event-type: strain-update-pr
37+
client-payload: |
38+
{
39+
"repo": "${{ github.repository }}",
40+
"sha": "${{ github.event.pull_request.head.sha }}",
41+
"head_ref": "${{ github.head_ref }}",
42+
"base_ref": "${{ github.base_ref }}",
43+
"strain_property": "${{ env.STRAIN_PROPERTY }}",
44+
"strain_property_value": "${{ env.PROPERTY_VALUE }}",
45+
"strain_path": "${{ inputs.STRAIN_PATH }}",
46+
"pr_number": "${{ github.event.number }}",
47+
"pr_action": "${{ github.event.action }}"
48+
}
49+
env:
50+
PROPERTY_VALUE: ${{ github.event.pull_request.merged && github.base_ref || github.head_ref }}

0 commit comments

Comments
 (0)