@@ -73,34 +73,23 @@ jobs:
7373 runs-on : ubuntu-latest
7474 needs : playwright-after-deploy4
7575 timeout-minutes : 120
76+ env :
77+ GH_TOKEN : ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
78+ REPO : dataquest-dev/dspace-rest-test
79+ WORKFLOW : run_unittests.yml
7680 steps :
7781 - name : run rest-tests
7882 run : |
79- curl -H "Accept: application/vnd.github.everest-preview+json" \
80- -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
81- --request POST \
82- https://api.github.com/repos/dataquest-dev/\
83- dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
84- --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
85-
86- # wait for it to start
87- sleep 30s
88-
89- # get result of last job
90- RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
83+ OUTPUT=$(gh workflow run "$WORKFLOW" \
84+ --repo "$REPO" \
85+ --ref master \
86+ -f CUSTOMER="${{ github.ref_name }}" \
87+ -f URL="http://dev-5.pc:84/server/api" 2>&1)
9188
92- # while job did not finish, sleep
93- while [[ $RES == 'null' ]]; do
94- sleep 10s
95- RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
96- done;
89+ RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+')
9790
98- echo $RES
99- # if last result is not success, return -1 and fail
100- if [[ $RES != \"success\" ]]; then
101- echo "rest-tests have failed! check appropriate action run"
102- exit 1
103- fi;
91+ echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID"
92+ gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status
10493
10594
10695 playwright-after-import4 :
@@ -113,34 +102,23 @@ jobs:
113102 runs-on : ubuntu-latest
114103 needs : playwright-after-import4
115104 timeout-minutes : 120
105+ env :
106+ GH_TOKEN : ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
107+ REPO : dataquest-dev/dspace-rest-test
108+ WORKFLOW : run_unittests.yml
116109 steps :
117110 - name : run rest-tests
118111 run : |
119- curl -H "Accept: application/vnd.github.everest-preview+json" \
120- -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
121- --request POST \
122- https://api.github.com/repos/dataquest-dev/\
123- dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
124- --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
125-
126- # wait for it to start
127- sleep 30s
128-
129- # get result of last job
130- RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
131-
132- # while job did not finish, sleep
133- while [[ $RES == 'null' ]]; do
134- sleep 10s
135- RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
136- done;
137-
138- echo $RES
139- # if last result is not success, return -1 and fail
140- if [[ $RES != \"success\" ]]; then
141- echo "rest-tests have failed! check appropriate action run"
142- exit 1
143- fi;
112+ OUTPUT=$(gh workflow run "$WORKFLOW" \
113+ --repo "$REPO" \
114+ --ref master \
115+ -f CUSTOMER="${{ github.ref_name }}" \
116+ -f URL="http://dev-5.pc:84/server/api" 2>&1)
117+
118+ RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+')
119+
120+ echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID"
121+ gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status
144122
145123 import-4 :
146124 runs-on : dspace-dep-1
0 commit comments