Files
pytorch/.github/scripts/report_git_status.sh
Huy Do 6f8751dcc9 Fix timeout check workflow lint job (#142476)
Fixes https://github.com/pytorch/pytorch/issues/142485

The workflow check lint job timed out in trunk, i.e. https://github.com/pytorch/pytorch/actions/runs/12261226178/job/34207762939, and here was what happened:

1. https://github.com/pytorch/pytorch/pull/142294 landed yesterday to build ROCm on 3.13, but the PR had a landrace with https://github.com/pytorch/pytorch/pull/142282 in the generated workflow file
2. The trunk lint check caught that in https://github.com/pytorch/pytorch/blob/main/.github/scripts/report_git_status.sh#L2
3. However, the script also attempted to print the difference with `git diff .github/workflows`.  This command was the one that stuck because `git diff` uses page by default and requires a prompt to display the next page ¯\_(ツ)_/¯

It took so long to debug this because a timeout Nova GHA doesn't print any progress.  I'll create an issue for this.

Bonus:

I also fix the broken print from test tool lint job that confuses GitHub https://github.com/pytorch/pytorch/actions/runs/12261226178 with an annotation failure `Credentials could not be loaded, please check your action inputs`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/142476
Approved by: https://github.com/wdvr
2024-12-10 20:47:22 +00:00

10 lines
205 B
Bash
Executable File

#!/usr/bin/env bash
set -eux
CHANGES=$(git status --porcelain "$1")
echo "$CHANGES"
# NB: Use --no-pager here to avoid git diff asking for a prompt to continue
git --no-pager diff "$1"
[ -z "$CHANGES" ]