Skip to content

Commit f3afa9a

Browse files
authored
Merge pull request #21 from trycourier/advanced-test-trigger
Added test trigger on push request
2 parents da97696 + 09e8e34 commit f3afa9a

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

.github/workflows/workflow.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,54 @@ on:
44
push:
55
branches: [master]
66
workflow_dispatch:
7+
pull_request:
8+
branches: [master]
79

810
jobs:
9-
notify-app:
11+
tests-on-push:
12+
if: github.event_name == 'push'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Dispatch App Build
16+
run: |
17+
curl -sS --fail-with-body -X POST \
18+
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
19+
-H "Accept: application/vnd.github+json" \
20+
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
21+
-d '{"event_type": "iOS-Flutter", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
22+
curl -sS --fail-with-body -X POST \
23+
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
24+
-H "Accept: application/vnd.github+json" \
25+
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
26+
-d '{"event_type": "Android-Flutter", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
27+
28+
tests-on-pr:
29+
if: github.event_name == 'pull_request'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Dispatch App Build
33+
run: |
34+
curl -sS --fail-with-body -X POST \
35+
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
36+
-H "Accept: application/vnd.github+json" \
37+
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
38+
-d "$(jq -n \
39+
--arg et 'iOS-Flutter' \
40+
--arg prnum '${{ github.event.pull_request.number }}' \
41+
--arg sh '${{ github.event.pull_request.head.sha }}' \
42+
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"
43+
curl -sS --fail-with-body -X POST \
44+
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
45+
-H "Accept: application/vnd.github+json" \
46+
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
47+
-d "$(jq -n \
48+
--arg et 'Android-Flutter' \
49+
--arg prnum '${{ github.event.pull_request.number }}' \
50+
--arg sh '${{ github.event.pull_request.head.sha }}' \
51+
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"
52+
53+
tests-manual:
54+
if: github.event_name == 'workflow_dispatch'
1055
runs-on: ubuntu-latest
1156
steps:
1257
- name: Dispatch App Build
@@ -15,9 +60,9 @@ jobs:
1560
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
1661
-H "Accept: application/vnd.github+json" \
1762
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
18-
-d '{"event_type": "iOS-Flutter", "client_payload": { "dummy_payload": "some_value_todo_logic" }}'
63+
-d '{"event_type": "iOS-Flutter", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
1964
curl -X POST \
2065
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
2166
-H "Accept: application/vnd.github+json" \
2267
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
23-
-d '{"event_type": "Android-Flutter", "client_payload": { "dummy_payload": "some_value_todo_logic" }}'
68+
-d '{"event_type": "Android-Flutter", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'

0 commit comments

Comments
 (0)