How to check script status after_script?

In the after_sctipt section, if the script section fails or success, still it runs as I keep allow_failure: true
But, how to check in after_script that whether script section failed/success so that I can pass the same in some api call in the after_script