Skip to content

Commit 917906a

Browse files
author
Matus Kasak
committed
Reduced the amount of code
1 parent 9f40456 commit 917906a

1 file changed

Lines changed: 17 additions & 65 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -212,46 +212,22 @@ jobs:
212212
REPO="dataquest-dev/dspace-rest-test"
213213
WORKFLOW="run_unittests.yml"
214214
215-
# Record time before dispatch to find the correct run later
216-
TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
217-
echo "Triggering REST tests at $TRIGGER_TIME"
218-
219-
# Trigger the workflow with inputs
220215
gh workflow run "$WORKFLOW" \
221216
--repo "$REPO" \
222217
--ref master \
223218
-f CUSTOMER="${{ github.ref_name }}" \
224219
-f URL="http://dev-5.pc:88/repository/server/api"
225220
226-
echo "Workflow dispatch triggered, waiting for run to appear..."
227221
sleep 15
228222
229-
# Find the run we just triggered
230-
RUN_ID=""
231-
for i in $(seq 1 12); do
232-
RUN_ID=$(gh run list \
233-
--repo "$REPO" \
234-
--workflow "$WORKFLOW" \
235-
--event workflow_dispatch \
236-
--created ">=$TRIGGER_TIME" \
237-
--limit 1 \
238-
--json databaseId,createdAt \
239-
--jq 'sort_by(.createdAt) | .[0].databaseId // empty')
240-
241-
if [[ -n "$RUN_ID" ]]; then
242-
echo "Found workflow run: $RUN_ID"
243-
break
244-
fi
245-
echo "Attempt $i: Run not found yet, waiting 15s..."
246-
sleep 15
247-
done
248-
249-
if [[ -z "$RUN_ID" ]]; then
250-
echo "::error::Could not find the triggered workflow run after 3 minutes"
251-
exit 1
252-
fi
253-
254-
# Watch the run until it completes (polls every 30s, shows live status)
223+
RUN_ID=$(gh run list \
224+
--repo "$REPO" \
225+
--workflow "$WORKFLOW" \
226+
--event workflow_dispatch \
227+
--limit 1 \
228+
--json databaseId \
229+
--jq '.[0].databaseId')
230+
255231
echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID"
256232
gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status
257233
@@ -269,50 +245,26 @@ jobs:
269245
env:
270246
GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}
271247
steps:
272-
- name: Trigger and watch REST tests
248+
- name: run rest-tests
273249
run: |
274250
REPO="dataquest-dev/dspace-rest-test"
275251
WORKFLOW="run_unittests.yml"
276252
277-
# Record time before dispatch to find the correct run later
278-
TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
279-
echo "Triggering REST tests at $TRIGGER_TIME"
280-
281-
# Trigger the workflow with inputs
282253
gh workflow run "$WORKFLOW" \
283254
--repo "$REPO" \
284255
--ref master \
285256
-f CUSTOMER="${{ github.ref_name }}" \
286257
-f URL="http://dev-5.pc:88/repository/server/api"
287258
288-
echo "Workflow dispatch triggered, waiting for run to appear..."
289259
sleep 15
290260
291-
# Find the run we just triggered (oldest after TRIGGER_TIME)
292-
RUN_ID=""
293-
for i in $(seq 1 12); do
294-
RUN_ID=$(gh run list \
295-
--repo "$REPO" \
296-
--workflow "$WORKFLOW" \
297-
--event workflow_dispatch \
298-
--created ">=$TRIGGER_TIME" \
299-
--limit 1 \
300-
--json databaseId,createdAt \
301-
--jq 'sort_by(.createdAt) | .[0].databaseId // empty')
302-
303-
if [[ -n "$RUN_ID" ]]; then
304-
echo "Found workflow run: $RUN_ID"
305-
break
306-
fi
307-
echo "Attempt $i: Run not found yet, waiting 15s..."
308-
sleep 15
309-
done
310-
311-
if [[ -z "$RUN_ID" ]]; then
312-
echo "::error::Could not find the triggered workflow run after 3 minutes"
313-
exit 1
314-
fi
315-
316-
# Watch the run until it completes
261+
RUN_ID=$(gh run list \
262+
--repo "$REPO" \
263+
--workflow "$WORKFLOW" \
264+
--event workflow_dispatch \
265+
--limit 1 \
266+
--json databaseId \
267+
--jq '.[0].databaseId')
268+
317269
echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID"
318270
gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status

0 commit comments

Comments
 (0)