/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/actions/workload_comment/action.yaml
156 строк
5 KB
Nikita Menkovich
fix: trying to fix reporting on timed out/cancelled/failed workflows (#6408)
04 авг 2026, 18:48
Не верифицирован
04 авг 2026, 18:48
3a311a0
Код
Авторство
О чём код?
name: Workload comment description: Initialize or update PR workload comments for split checks inputs: command: required: true description: "init or update" build_preset: required: true description: "Build preset suffix, for example relwithdebinfo" target_platform: required: false default: "" description: "ya make target platform used to classify cross-compiled workloads" matrix_include: required: false default: "" description: "Matrix include JSON used by init" workload_status: required: false default: "in_progress" description: "Overall workload status for init" component: required: false default: "" description: "Matrix component for update" workload_check_status: required: false default: "" description: "running, completed, failed_build, failed, cancelled, timed_out, skipped, or report_failed" current_job_name: required: false default: "" description: "Current GitHub Actions job name for live link lookup" runner_name: required: false default: "" description: "Runner name for narrowing the current job lookup" add_summary_link: required: false default: "no" description: "Append resolved job link to GITHUB_STEP_SUMMARY" build_error_log_url: required: false default: "" description: "URL to extracted build error log for failed build workload rows" outputs: job_url: description: "Resolved GitHub Actions job URL" value: ${{ steps.update.outputs.job_url }} runs: using: composite steps: - name: install dependencies shell: bash run: | if ! pip install -r .github/scripts/requirements.txt; then echo "::warning::Failed to install workload comment dependencies; continuing because PR comments are non-critical" fi - name: resolve build preset id: build-preset shell: bash env: BUILD_PRESET: ${{ inputs.build_preset }} TARGET_PLATFORM: ${{ inputs.target_platform }} RUNNER_ARCH: ${{ runner.arch }} run: | set -euo pipefail case "$RUNNER_ARCH" in X64) platform_name="linux-x86_64" ;; ARM64) platform_name="linux-arm64" ;; *) platform_name="$(uname | tr '[:upper:]' '[:lower:]')-$(arch)" ;; esac case "$TARGET_PLATFORM" in default-linux-armv9a_grace) platform_name="linux-arm64" ;; esac echo "full_build_preset=${platform_name}-${BUILD_PRESET}" >> "$GITHUB_OUTPUT" - name: initialize workload comment if: ${{ inputs.command == 'init' }} shell: bash env: GITHUB_TOKEN: ${{ github.token }} MATRIX_INCLUDE: ${{ inputs.matrix_include }} FULL_BUILD_PRESET: ${{ steps.build-preset.outputs.full_build_preset }} WORKLOAD_STATUS: ${{ inputs.workload_status }} run: | set -euo pipefail export PYTHONPATH="${PYTHONPATH:-}:$GITHUB_WORKSPACE/.github" for attempt in 1 2 3; do if python3 -m scripts.tests.workload_comment init \ --matrix-include "${MATRIX_INCLUDE}" \ --build-preset "${FULL_BUILD_PRESET}" \ --workload-status "${WORKLOAD_STATUS}"; then exit 0 fi if [ "$attempt" -lt 3 ]; then delay=$((attempt * 5)) echo "::warning::Failed to initialize workload PR comment on attempt ${attempt}; retrying in ${delay}s" sleep "$delay" fi done echo "::warning::Failed to initialize workload PR comment after 3 attempts; continuing because PR comments are non-critical" - name: update workload comment if: ${{ inputs.command == 'update' }} id: update shell: bash env: GITHUB_TOKEN: ${{ github.token }} FULL_BUILD_PRESET: ${{ steps.build-preset.outputs.full_build_preset }} COMPONENT: ${{ inputs.component }} WORKLOAD_CHECK_STATUS: ${{ inputs.workload_check_status }} CURRENT_JOB_NAME: ${{ inputs.current_job_name }} RUNNER_NAME: ${{ inputs.runner_name }} BUILD_ERROR_LOG_URL: ${{ inputs.build_error_log_url }} run: | set -euo pipefail export PYTHONPATH="${PYTHONPATH:-}:$GITHUB_WORKSPACE/.github" JOB_URL_OUT=$(mktemp) if ! python3 -m scripts.tests.workload_comment update \ --build-preset "${FULL_BUILD_PRESET}" \ --component "${COMPONENT}" \ --workload-check-status "${WORKLOAD_CHECK_STATUS}" \ --current-job-name "${CURRENT_JOB_NAME}" \ --runner-name "${RUNNER_NAME}" \ --build-error-log-url "${BUILD_ERROR_LOG_URL}" \ --job-url-out "$JOB_URL_OUT"; then echo "::warning::Failed to update workload PR comment; continuing because PR comments are non-critical" fi echo "job_url=$(cat "$JOB_URL_OUT")" >> "$GITHUB_OUTPUT" rm -f "$JOB_URL_OUT" - name: add job link to summary if: ${{ inputs.command == 'update' && inputs.add_summary_link == 'yes' && steps.update.outputs.job_url != '' }} shell: bash env: JOB_URL: ${{ steps.update.outputs.job_url }} run: | { echo "### GitHub job" echo echo "- [Build and test job](${JOB_URL})" echo } >> "$GITHUB_STEP_SUMMARY"