Forward rendering with arbitrary number of lights

I have a forward renderer build over OpenGL, until now it is limited to a maximun combination of four lights, which I process in one pass ( shader call ).

I would like to implement the idea exposed in this reply:
(Multiple lights framework best practices advice - #9 by Dark_Photon)

which combinates a N maximun of lights in one pass, and if there are more than the maximum number of lights, follow with another pass accumlating it with additve blending.

But my question is about which steps I need to follow to combine it with the diffuse color, the directional light and the ambient light of the scene without a composition shader.

You just render the scene multiple times. Each pass uses a different group of lights. All passes other than the first use additive blending. Ambient light is only applied on the first pass, as is any emissive material component.

Or you could have the first pass only apply ambient light and any emissive component, with all directional and positional lights processed in later passes.

The downsides of this approach (compared to deferred lighting) are that you’re running the vertex shader for each pass (unless you use transform feedback to capture the output then use that for subsequent passes), and each pass is performing texture lookups.