|
| 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