The NKJV reads:
For truly against Your holy Servant Jesus, whom You anointed, both Herod and Pontius Pilate, with the Gentiles and the people of Israel, were gathered together 28 to do whatever Your hand and Your purpose determined before to be done.
Most translations translate it as Jesus's enemies as doing God's will, which I think breaks the argument. I see it that Jesus did God's will. The interlinear Greek text has parenthetical commas around "both Herod ... gathered together" and therefore implies that the 'to do' infinitive relates to the preceding "Jesus, whom You appointed (...) to do whatever your hand ....
So is there linguistic evidence to connect 'to do' with 'appointed' as opposed to the immediate preceding 'gathered'?
I suggest there is the element of context, as the quotation is being used: 1) to urge people, early Christians, to resist evil like Jesus did, not that evil people are doing God's will, and 2) previously evil kings worked against the Lord.