Skip to content

Commit

Permalink
container: make the non-debug output nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Sep 6, 2024
1 parent 75074d7 commit 3fe529c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions container/cmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ if test "$GITHUB_EVENT_NAME" = 'pull_request'; then
git config --global advice.detachedHead false
git config --global init.defaultBranch main

echo "## New code: $INPUT_PULL_REQUEST_HEAD ##"
(
echo "## Checking out $INPUT_PULL_REQUEST_HEAD ##"
$debug_mode || exec &>/dev/null
git fetch origin "+$INPUT_PULL_REQUEST_HEAD:refs/remotes/pull-requests/pr-detached-$INPUT_PULL_REQUEST_ID"
git checkout "$INPUT_PULL_REQUEST_HEAD"
Expand All @@ -90,6 +90,7 @@ if test "$GITHUB_EVENT_NAME" = 'pull_request'; then

# Get the last commit before this PR.
last_committed=$(git rev-parse "HEAD~$INPUT_PULL_REQUEST_COMMITS")
echo "## Old code: $last_committed ##"
linter_options+=( --compare-against "$last_committed" )

test -z "$INPUT_SUBDIRECTORY" || INPUT_SUBDIRECTORIES=$INPUT_SUBDIRECTORY
Expand All @@ -100,8 +101,12 @@ if test "$GITHUB_EVENT_NAME" = 'pull_request'; then
analyze_subdir "$subdir"
done

# Return back to the previous git-sha1
git checkout "$GITHUB_SHA"
(
# Return back to the previous git-sha1, upload-sarif action doesn't
# really like mismatches.
$debug_mode || exit &>/dev/null
git checkout "$GITHUB_SHA"
)
else
touch "$rootdir/output.sarif.err"
fi
Expand Down

0 comments on commit 3fe529c

Please sign in to comment.