Luke's trajectory can be see as an 'averted' tragedy of many kinds....
There's the fact he finds out Leia is his twin sister before anything 'happens' between them (averting the tragedy of Turin Turambar from Tolkien's Silmarillion/Children of Hurin, itself inspired by the tragic Finnish tale of Kullervo).
There's the fact that the tragic Irish myth of Cu Chulainn and Connla (father accidentally/unwittingly killing his own son) is basically averted in ESB by the fact he knows Luke is his son (and the reveal is the other way around).
Likewise, Luke in RotJ is (to use fialleril's iconic phrase) 'Orpheus Triumphant', rather than the tragic version who fails to bring his loved one back from the Underworld. (Even Leia is an Orpheus Triumphant figure in her own right because she embarks on an ultimately successful mission to rescue Han from the Underworld of Jabba's palace at the beginning of RotJ as well!)
And this doesn't even go into how Luke's hero's journey has many similar beats as Anakin's fall, with the PT a purposefully constructed mirror image to the OT. Viewing them side-by-side shows how Luke is faced with similar temptations, but makes different choices with happier outcomes. (Again, Luke is the Galahad to Anakin's Lancelot.)
The only real difference between a tragedy and a comedy in the theatrical sense *is* the ending. Much has been written about how many Shakespeare comedies could so easily be turned into tragedies (and vice versa) just by altering the final scenes.
And in the case of the Skywalker saga, this is why the ending of RotJ is so crucial.... it's all about that eucatastrophe — the sudden, miraculous turn of fate that reverses the tragedy — aka, what Tolkien famously argues is the defining feature of the happy ending of a fairy tale.
In this case, it is the seemingly-impossible redemption and return of Anakin Skywalker which saves Luke from an almost-certain doom, and which defeats the Sith and frees the galaxy.
On the topic of tales of redemption, Joseph Campbell, Lucas's biggest mythopoeic inspiration, writes:
“Sober, modern ... judgment is founded on a total misunderstanding of the realities depicted in the fairy tale, the myth, and the divine comedies of redemption. These, in the ancient world, were regarded as of a higher rank than tragedy, of a deeper truth, of a more difficult realization, of a sounder structure, and of a revelation more complete. The happy ending of the fairy tale, the myth, and the divine comedy of the soul, is to be read, not as a contradiction, but as a transcendence of the universal tragedy of man.”