Skip to content

fix: remove auto-execution from library sub-modules bundled into mention-reply#178

Merged
derekmisler merged 1 commit into
docker:mainfrom
docker-agent:fix/mention-reply-bundled-entrypoints
May 6, 2026
Merged

fix: remove auto-execution from library sub-modules bundled into mention-reply#178
derekmisler merged 1 commit into
docker:mainfrom
docker-agent:fix/mention-reply-bundled-entrypoints

Conversation

@docker-agent

Copy link
Copy Markdown
Contributor

Problem

When tsup bundles dist/mention-reply.js, it inlines the four library sub-modules (add-reaction, check-org-membership, get-pr-meta, post-comment). Each had a top-level auto-execution block:

if (!process.env.VITEST) {
  run().catch((err) => core.setFailed(...))
}

When the runner loads the bundle, all four standalone run() functions fire — not just mention-reply's. They call core.getInput('owner', { required: true }) etc., inputs that aren't set in the mention-reply context, causing:

Input required and not supplied: owner  (×3)
Input required and not supplied: org    (×1)

Failing run: https://github.com/docker/gordon/actions/runs/25450919377/job/74667539670

Fix

  • Remove the auto-execution block and the dead run() function definition from each of the four library sub-modules. None are used as standalone GitHub Action entrypoints — they are pure library helpers bundled only to remain individually testable/usable.
  • Drop the now-unused import * as core from the three modules that no longer reference core at all (check-org-membership, get-pr-meta, post-comment).
  • Upgrade .github/actions/mention-reply/action.yml from node20 to node24 (deprecation warning fix).

Testing

pnpm build && pnpm test && pnpm lint all pass (biome + tsc clean, 100/100 unit tests pass; actionlint is not available in the sandbox but the only YAML change is the well-known node20node24 runtime value).

…ion-reply

When tsup bundles dist/mention-reply.js it inlines add-reaction,
check-org-membership, get-pr-meta, and post-comment. Each had a top-level
if (!process.env.VITEST) { run().catch(...) } guard that fired on bundle
load, calling core.getInput('owner', { required: true }) etc. — inputs that
are not set in the mention-reply action context — causing the job to fail.

None of these four modules are used as standalone GitHub Action entrypoints;
they are pure library helpers. Remove the auto-execution block and dead run()
function from each, and drop the now-unused `import * as core` from the
three modules that no longer need it.

Also upgrade .github/actions/mention-reply/action.yml from node20 to node24.

Assisted-By: docker-agent
@docker-agent
docker-agent requested a review from a team as a code owner May 6, 2026 17:39
@docker-agent
docker-agent requested a review from derekmisler May 6, 2026 17:39

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

This PR correctly diagnoses and fixes the 'Input required and not supplied' failures in the mention-reply action.

Root cause (confirmed correct): src/mention-reply/index.ts imports from add-reaction, check-org-membership, get-pr-meta, and post-comment. Because tsup bundles with splitting: false and noExternal: [/.*/], all four sub-modules' code is inlined into dist/mention-reply.js. When GitHub Actions loads that file, Node.js executes every top-level statement — including the if (!process.env.VITEST) { run() } blocks from each sub-module, which immediately called core.getInput('owner', { required: true }) etc., triggering the errors.

Changes reviewed:

  • add-reaction/index.ts — standalone run() entrypoint removed; no action.yml references this bundle directly
  • check-org-membership/index.ts — standalone entrypoint + now-unused @actions/core import removed; exported checkOrgMembership function is unaffected
  • get-pr-meta/index.ts — same pattern; getPrMeta function unaffected
  • post-comment/index.ts — same pattern; postComment function unaffected
  • .github/actions/mention-reply/action.ymlnode20node24 aligns the runner with the tsup build target; GitHub Actions has supported node24 since runner v2.316.1+

No standalone action.yml files exist for the four modified sub-modules, so removing their run() entrypoints does not break any existing invocations.

@docker-agent

docker-agent Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

PR Review Failed — The review agent encountered an error and could not complete the review. View logs.

@derekmisler
derekmisler merged commit 79966a8 into docker:main May 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants