feat(ui): linkify URLs in workflow warning and error messages (#1272) #687
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Update Submodule | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - 'release/**' | |
| jobs: | |
| trigger-gitlab: | |
| runs-on: self-hosted | |
| environment: | |
| name: update-submodule | |
| steps: | |
| - name: Trigger Submodule Update | |
| env: | |
| GITLAB_TRIGGER_TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }} | |
| GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }} | |
| GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }} | |
| EVENT_CREATED: ${{ github.event.created }} | |
| run: | | |
| if [ "${GITHUB_EVENT_NAME}" = "push" ] && [ "${EVENT_CREATED}" = "true" ]; then | |
| echo "Skipping GitLab pipeline trigger for branch creation: ${GITHUB_REF_NAME}" | |
| exit 0 | |
| fi | |
| is_release_branch() { | |
| release_version="${GITHUB_REF_NAME#release/}" | |
| major="${release_version%%.*}" | |
| minor="${release_version#*.}" | |
| [ "$major" != "$release_version" ] || return 1 | |
| [ -n "$major" ] || return 1 | |
| [ -n "$minor" ] || return 1 | |
| [ "${minor#*.}" = "$minor" ] || return 1 | |
| case "${major}${minor}" in | |
| *[!0-9]*) | |
| return 1 | |
| ;; | |
| *) | |
| return 0 | |
| ;; | |
| esac | |
| } | |
| case "${GITHUB_REF_NAME}" in | |
| main) | |
| TRIGGER_SOURCE="github_main_merge" | |
| ;; | |
| release/*) | |
| if is_release_branch; then | |
| TRIGGER_SOURCE="github_release_merge" | |
| else | |
| echo "Skipping unsupported release branch: ${GITHUB_REF_NAME}" | |
| exit 0 | |
| fi | |
| ;; | |
| *) | |
| echo "Unsupported branch: ${GITHUB_REF_NAME}" | |
| exit 1 | |
| ;; | |
| esac | |
| echo "Triggering GitLab pipeline for commit: ${GITHUB_SHA}" | |
| RESPONSE=$(curl -X POST \ | |
| -F token="${GITLAB_TRIGGER_TOKEN}" \ | |
| -F ref="${GITHUB_REF_NAME}" \ | |
| -F "variables[GITHUB_COMMIT_SHA]=${GITHUB_SHA}" \ | |
| -F "variables[TRIGGER_SOURCE]=${TRIGGER_SOURCE}" \ | |
| -F "variables[GITHUB_REPO]=${GITHUB_REPOSITORY}" \ | |
| -w "\n%{http_code}" \ | |
| "${GITLAB_API_URL}/projects/${GITLAB_PROJECT_ID}/trigger/pipeline") | |
| HTTP_CODE=$(echo "$RESPONSE" | tail -n1) | |
| if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then | |
| echo "✅ Successfully triggered GitLab pipeline" | |
| else | |
| echo "❌ Failed to trigger GitLab pipeline" | |
| echo "HTTP Status: $HTTP_CODE" | |
| exit 1 | |
| fi | |
| - name: Log trigger details | |
| if: success() | |
| run: | | |
| echo "Triggered GitLab pipeline" | |
| echo "GitHub Commit: ${{ github.sha }}" | |
| echo "Triggered By: ${{ github.actor }}" | |
| - name: Report failure | |
| if: failure() | |
| run: | | |
| echo "❌ Failed to trigger GitLab pipeline" | |
| echo "GitHub Commit: ${{ github.sha }}" | |
| echo "Please check the workflow logs and GitLab configuration" |