The full Oxford English Dictionary includes these two definitions...
undertake
4a - To take upon oneself; to take in hand.
Sometimes contextually ‘to enter upon, begin’.
4c - To give a formal promise or pledge that; to take upon oneself to promise or affirm; to venture to assert.
(where definitions 1-3 are all marked "obsolete"). Clearly there's a difference between actually beginning to do something, and simply promising to do it. But contextually it's usually obvious which sense is intended. Note that in between those two definitions, the OED has...
4b Const. to with infinitive. (Sometimes implying a solemn pledge or promise: cf. next.)
...which has no associated explicit definition. Contextually you might therefore reasonably suppose 4b is "the same" definition as 4a (the only difference being the syntax of usage with an infinitive rather than noun). But semantically I attach significance to highlighted cf next in the above (implying that the syntax of 4b is particularly relevant to sense 4c).
Both of OP's examples are syntactically valid, but because to go forward pretty much means to start, to begin, there might be some disagreement as to exactly what either or both actually mean. My own off-the-cuff interpretation, with no further context, would be...
We might undertake going forward
= We may try or adopt the strategy of going forward
(as opposed to going backward or sideways?!)
We might undertake to go forward
= We may publicly commit ourselves to the strategy of going forward