@@ -37,13 +37,16 @@ jobs:
3737 MERGE_REF="${{ steps.setref.outputs.merge_ref }}"
3838 echo "Triggering GitLab pipeline for ref: $MERGE_REF"
3939
40+ GITHUB_PIPELINE_NAME="GitHub #${{ github.event.issue.number }}: ${{ steps.setref.outputs.pr_title }}"
41+
4042 RESPONSE=$(curl -s -X POST \
4143 -F token=${{ secrets.HPSF_GITLAB_TRIGGER_TOKEN }} \
4244 -F ref=development \
4345 -F "variables[GITHUB_PR_NUMBER]=${{ github.event.issue.number }}" \
4446 -F "variables[GITHUB_MERGE_REF]=refs/pull/${{ github.event.issue.number }}/merge" \
4547 -F "variables[GITHUB_TRIGGER_ACTOR]=${{ github.actor }}" \
4648 -F "variables[GITHUB_PR_TITLE]=${{ steps.setref.outputs.pr_title }}" \
49+ -F "variables[GITHUB_PIPELINE_NAME]=${GITHUB_PIPELINE_NAME}" \
4750 "https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/trigger/pipeline")
4851
4952 echo "GitLab response: $RESPONSE"
6063 echo "pipeline_url=$PIPELINE_URL" >> $GITHUB_OUTPUT
6164 echo "pipeline_id=$PIPELINE_ID" >> $GITHUB_OUTPUT
6265
63- # Update pipeline name
64- PIPELINE_NAME="GitHub #${{ github.event.issue.number }}: ${{ steps.setref.outputs.pr_title }}"
65- curl --request PUT \
66- --header "PRIVATE-TOKEN: ${{ secrets.HPSF_GITLAB_API_TOKEN }}" \
67- --data-urlencode "name=${PIPELINE_NAME}" \
68- "https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/${PIPELINE_ID}/metadata"
69- || echo "Warning: Failed to update pipline name (possibly expired token)"
70- echo "Updated pipeline name to: $PIPELINE_NAME"
71-
7266 - name : Post status to GitHub PR
7367 shell : bash
7468 run : |
9084 echo "Waiting on GitLab pipeline $PIPELINE_ID..."
9185
9286 STATUS="running"
93- MAX_WAIT=14400 # 4 hours
87+ MAX_WAIT=86400 # 24 hours
9488 ELAPSED=0
9589
9690 while [[ "$STATUS" == "running" || "$STATUS" == "pending" ]]; do
@@ -100,8 +94,13 @@ jobs:
10094 exit 1
10195 fi
10296
103- sleep 300
104- ELAPSED=$((ELAPSED + 300))
97+ if [ $ELAPSED -lt 7200 ]; then
98+ SLEEP_TIME=600 # 10 minutes
99+ else
100+ SLEEP_TIME=3600 # 1 hour
101+ fi
102+ sleep $SLEEP_TIME
103+ ELAPSED=$((ELAPSED + SLEEP_TIME))
105104
106105 STATUS=$(curl -s \
107106 "https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/$PIPELINE_ID" \
0 commit comments