Port over the fix from https://github.com/github/codeql-action/pull/1544 and share code so these scripts don't get out of sync again.