This shortcut demonstrates how to use a variable value in an IF condition.
Download and unzip. Then, double-click on the shortcut and it'll import it into the Shortcuts app.
Once imported, you should edit the shortcut to see the comments, the items to configure, how it's all put together and to run it in your environment. It's a good starting point for a shortcut that needs to do IF conditions.