Infinitive or gerund complement clause
Both are grammatical, but sometimes the to-infinitive describes a possible action (particularly when the preceding clause includes would), and the -ing form describes the actual performance of the action. Whether that distinction is relevant in this case could be determined only by knowing more about the context.