@@ -68,32 +68,21 @@ jobs:
6868 rest-tests-after-deploy2 :
6969 runs-on : ubuntu-latest
7070 needs : playwright-after-deploy2
71- timeout-minutes : 45
71+ timeout-minutes : 120
72+ env :
73+ GH_TOKEN : ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
74+ REPO : dataquest-dev/dspace-rest-test
75+ WORKFLOW : run_unittests.yml
7276 steps :
7377 - name : run rest-tests
7478 run : |
75- curl -H "Accept: application/vnd.github.everest-preview+json" \
76- -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
77- --request POST \
78- https://api.github.com/repos/dataquest-dev/\
79- dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
80- --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
81-
82- # wait for it to start
83- sleep 30s
84-
85- # get result of last job
86- 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)
79+ OUTPUT=$(gh workflow run "$WORKFLOW" \
80+ --repo "$REPO" \
81+ --ref master \
82+ -f CUSTOMER="${{ github.ref_name }}" \
83+ -f URL="http://dev-5.pc:82/server/api" 2>&1)
8784
88- # while job did not finish, sleep
89- while [[ $RES == 'null' ]]; do
90- sleep 10s
91- 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)
92- done;
85+ RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+')
9386
94- echo $RES
95- # if last result is not success, return -1 and fail
96- if [[ $RES != \"success\" ]]; then
97- echo "rest-tests have failed! check appropriate action run"
98- exit 1
99- fi;
87+ echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID"
88+ gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status
0 commit comments