xref: /third_party/node/tools/actions/start-ci.sh
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/tools/actions/
11cb0ef41Sopenharmony_ci#!/bin/sh
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciset -xe
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciREQUEST_CI_LABEL="request-ci"
61cb0ef41Sopenharmony_ciREQUEST_CI_FAILED_LABEL="request-ci-failed"
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cifor pr in "$@"; do
91cb0ef41Sopenharmony_ci  gh pr edit "$pr" --remove-label "$REQUEST_CI_LABEL"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci  ci_started=yes
121cb0ef41Sopenharmony_ci  rm -f output;
131cb0ef41Sopenharmony_ci  ncu-ci run "$pr" >output 2>&1 || ci_started=no
141cb0ef41Sopenharmony_ci  cat output
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci  if [ "$ci_started" = "no" ]; then
171cb0ef41Sopenharmony_ci    # Do we need to reset?
181cb0ef41Sopenharmony_ci    gh pr edit "$pr" --add-label "$REQUEST_CI_FAILED_LABEL"
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci    # shellcheck disable=SC2154
211cb0ef41Sopenharmony_ci    cqurl="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
221cb0ef41Sopenharmony_ci    body="<details><summary>Failed to start CI</summary><pre>$(cat output)</pre><a href='$cqurl'>$cqurl</a></details>"
231cb0ef41Sopenharmony_ci    echo "$body"
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci    gh pr comment "$pr" --body "$body"
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci    rm output
281cb0ef41Sopenharmony_ci  fi
291cb0ef41Sopenharmony_cidone;
30

Indexes created Thu Nov 07 10:32:03 CST 2024