-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (25 loc) · 1.08 KB
/
repository_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
name: Target Repository Workflow
on:
repository_dispatch:
types: [main-workflow-initiate]
jobs:
main-workflow:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Trigger the main workflow
run: |
WORKFLOW_ID=$(curl -s -H "Authorization: token ${TOKEN}" \
"https://api.github.com/repos/umasad087/RepoA/actions/workflows/trigger-and-wait.yml" \
| jq -r '.id')
curl -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/umasad087/RepoA/actions/workflows/$WORKFLOW_ID/dispatches" \
-d '{\"event_type\": \"main-workflow\","ref": "main", "inputs": {}}'
echo "Triggered by user: ${{ github.event.client_payload.username }}"
echo "From repository: ${{ github.event.client_payload.repo_url }}"
echo "With commit message: ${{ github.event.client_payload.commit_message }}"
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}