How to check if a variable is Masked or not from the runner's bash

I have use case where a variable will be defined in the project settings. I need to check if the variable is masked or not from a job and raise alert if the variable is not masked
Is there way in gitlab to check if the variable is masked or not in a job?