I understand your issue — I tried this myself in a Retool Workflow and ran into the same behavior.
After testing a few different approaches, I found that Octokit can’t be imported or used inside Retool Workflows. Workflows run in a sandboxed CommonJS environment, and they don’t support ES Modules, which Octokit depends on.
Because of that:
import { App } from "octokit"
Setting "type": "module"
require("octokit") (Octokit is ESM-only)
Even if the dependency is added in the workflow’s package.json, the runtime can’t execute it, which is why you see errors like “Import statements are not supported” or ERR_REQUIRE_ESM.
I also tested calling GitHub directly and confirmed that external APIs work fine in workflows when using an HTTP Request block (this is actually what Octokit wraps internally). So the recommended workaround in a workflow is:
Use an HTTP Request step for GitHub APIs
Use JS steps only to process the response
If you need to use Octokit itself, it works in a Retool Agent, Code Repo, or external Node service, but not inside workflows.
Hope this helps clarify things and saves some debugging time.