From 292e521d7cd0961a51f49d78132f997940df0402 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 9 Feb 2026 23:35:14 +0900 Subject: [PATCH] tools: Update tidy.sh --- tools/tidy.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/tidy.sh b/tools/tidy.sh index 6f129edf..0aa9562a 100755 --- a/tools/tidy.sh +++ b/tools/tidy.sh @@ -894,10 +894,19 @@ EOF for job in $(jq -c '.jobs | to_entries[] | select(.value.steps)' <<<"${workflow}"); do name=$(jq -r '.key' <<<"${job}") job=$(jq -r '.value' <<<"${job}") + eval "$(jq -r '@sh "RUNS_ON=\(."runs-on") TIMEOUT_MINUTES=\(."timeout-minutes") JOB_DEFAULT_SHELL=\(.defaults.run.shell)"' <<<"${job}")" + if [[ "${TIMEOUT_MINUTES}" == 'null' ]]; then + error ".jobs.${name}.timeout-minutes must be set" + fi + if [[ "${RUNS_ON}" == 'ubuntu-slim' ]]; then + case "${TIMEOUT_MINUTES}" in + ? | 1[0-5]) ;; + *) error ".jobs.${name}.timeout-minutes must be <= 15 because max execution time of ubuntu-slim runner is 15 minutes" ;; + esac + fi n=0 - job_default_shell=$(jq -r '.defaults.run.shell' <<<"${job}") - if [[ "${job_default_shell}" == 'null' ]]; then - job_default_shell="${default_shell}" + if [[ "${JOB_DEFAULT_SHELL}" == 'null' ]]; then + JOB_DEFAULT_SHELL="${default_shell}" fi for step in $(jq -c '.steps[]' <<<"${job}"); do prepare='' @@ -908,7 +917,7 @@ EOF fi if [[ "${shell}" == 'null' ]]; then if [[ -z "${prepare}" ]]; then - shell="${job_default_shell}" + shell="${JOB_DEFAULT_SHELL}" elif grep -Eq '^ *chsh +-s +[^ ]+/bash' <<<"${prepare}"; then shell='bash' else