# Automate save as shapekey for multiple animation actions

I have a model with a armature with several animation actions in it, these actions are facial expressions, and i'm converting each action to a shape key using the "save as shapekey" option in the armature modifier for the model, there are two ways that i'm doing this manually

First way is selecting the armature > selecting the action > selecting the model > save as shape key > repeat

The other way i can do this manually is creating copies of the armature + mesh > selecting a different action for each armature copie > select all models > go to the shape key tab for one of the models > join as shapes

I have been looking for a way to automate one these tasks with python, or if there is a easier way to do this within blender

bpy.context.view_layer.objects.active = bpy.data.objects['M_Head']