Skip to content

Commit d6538a3

Browse files
committed
chore: enhance debug logging in Auth0 CLI action for improved error handling and file cleanup
1 parent b1a96bd commit d6538a3

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/actions/configure-auth0-screens/action.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,26 @@ runs:
422422
fi
423423
424424
# Clean up temp file
425-
echo "Cleaning up temp file for screen: $screen"
426-
rm -f "$SETTINGS_FILE"
425+
echo "Debug: Preparing to clean up temp file for screen '$screen'. Path: '$SETTINGS_FILE'"
426+
if [ ! -f "$SETTINGS_FILE" ]; then
427+
echo "::warning::SETTINGS_FILE ('$SETTINGS_FILE') does not exist or is not a regular file before rm. Skipping rm."
428+
else
429+
echo "Debug: Attempting rm -f -v '$SETTINGS_FILE' (verbose and force)"
430+
# Temporarily disable exit on error to capture rm's status
431+
set +e
432+
rm_output=$(rm -f -v "$SETTINGS_FILE" 2>&1)
433+
rm_exit_code=$?
434+
set -e # Re-enable exit on error
435+
436+
if [ $rm_exit_code -eq 0 ]; then
437+
echo "Debug: Successfully removed '$SETTINGS_FILE'. Output from rm: $rm_output"
438+
else
439+
echo "::error::COMMAND 'rm -f -v "$SETTINGS_FILE"' FAILED with exit code $rm_exit_code."
440+
echo "Debug: Output from failed rm: $rm_output"
441+
echo "::error::This failure in 'rm' is causing the script to exit. Review permissions or file status."
442+
exit $rm_exit_code # Manually exit with rm's error code to make it explicit this is the failure point.
443+
fi
444+
fi
427445
428446
done < <(echo "$SCREENS_JSON" | jq -r '.[]' || echo "Failed to parse built screens JSON from input")
429447

0 commit comments

Comments
 (0)