After beginning a sentence with "The question is," should the question itself use inverted or straight syntax?

After beginning a sentence with "The question is," should the question itself use inverted or straight syntax?

  • The question is, when is it worth doing, and when is it not?
  • The question is when it is worth doing, and when it is not."

Both your variants are acceptable. The comma you included immediately after "The question is" in the first variant turns your question into a direct question (which therefore requires a question mark and the inverted syntax).

The second variant does not include the comma; the result is a version of the question which has the format of reported speech, and therefore does not require a question mark.

My only quibble is that "worth to do it" is not idiomatic English, and would be better phrased as "worth doing [it]". (The 'it' enclosed in square brackets is optional.)