How can I access Lightmapping settings for a light via script?

I need to change the value of a given light in my scene from lightmapping ‘auto’ to ‘baked’ via a script, but it is not currently exposed in the API - how can I do this?

The lines of script you would need are :

Light go = o as Light;

SerializedObject serialObj = new SerializedObject(go);
SerializedProperty lightmapProp = serialObj.FindProperty(“m_Lightmapping”);

lightmapProp.intValue = (int)lightmapping;
serialObj.ApplyModifiedProperties();

Use this wizard script to test in the Unity editor

To add to the primary answer, this is is a super useful reference: https://github.com/MattRix/UnityDecompiled/blob/master/UnityEditor/UnityEditor/LightEditor.cs