How to load a order status comment by comment id in Magento 2?

Load specific order status comment by the order status comment ID in Magento 2 to retrieve status history data.

A helpful method is public function get($commentId) from the OrderStatusHistoryRepository Interface of the Sales Module.

Be sure you have a valid comment id to get order status comment data,

namespace Jesadiya\LoadOrderStatus\Model;

use Magento\Sales\Api\Data\OrderStatusHistoryInterface;
use Magento\Sales\Api\OrderStatusHistoryRepositoryInterface;
use Psr\Log\LoggerInterface;

class LoadOrderStatus
     * @var OrderStatusHistoryRepositoryInterface
    private $historyRepository;

     * @var LoggerInterface
    private $logger;

    public function __construct(
        OrderStatusHistoryRepositoryInterface $historyRepository,
        LoggerInterface $logger
    ) {
        $this->historyRepository = $historyRepository;
        $this->logger = $logger;

     * load sales order status history by comment id
     * @param int $commentId
     * @return OrderStatusHistoryInterface|null
    public function loadComment(int $commentId): ?OrderStatusHistoryInterface
        $historyCommment = null;
        try {
            $historyCommment = $this->historyRepository->get($commentId);
        } catch (\Exception $exception) {

Call method with argument comment id of the given order status history.

$commentId = 1;
$orderStatusComment = $this->loadComment($commentId);

Output: Order status history interface methods.