Github actions not picking error

I created a workflow for my django project. Although the job shows a success status after running the workflow, when I checked the workflow log there was some errors with “python migrate” command. That error was not picked up by the workflow.
The error is as follows,
MySQLdb._exceptions.OperationalError: (1060, “Duplicate column name ‘task_args’”)
Even though there was this error in the log, I don’t know why the workflow has a green tick(success status).
Is there any way to track this error and exit the job.

A run step will recognize an error if the command exits with a non-zero exit code. You’ll have to look at the script and ensures it does that (crashing with the exception works!).