Bug Report
File: actions/setup/js/add_comment.cjs
Summary
add_comment.cjs calls resolveInvocationContext(rawContext) (via resolveEffectiveEventContext, line ~53) to obtain an invocation object that includes invocation.workflowRepo. However, when building the footer run URL further down, it uses context.repo directly instead of invocation.workflowRepo:
// line ~580
const runUrl = buildWorkflowRunUrl(context, context.repo);
The invocation.workflowRepo value is only used for eventName and eventPayload inside resolveEffectiveEventContext — it is never propagated to buildWorkflowRunUrl.
Impact
In repository_dispatch-triggered workflows that target a different repository than the one hosting the workflow, context.repo is typically patched to the target repo so that safe-output actions (comments, labels, etc.) go to the right place. resolveInvocationContext correctly resolves workflowRepo as the original workflow repo in this scenario, but since add_comment.cjs ignores it and uses the patched context.repo instead, the {run_url} in comment footers points to the target repo rather than the workflow repo where the run actually lives.
The existing workaround for the activation comment (add_workflow_run_comment.cjs) is a runtime sed patch:
sed -i 's/buildWorkflowRunUrl(context, context\.repo)/buildWorkflowRunUrl(context, context.workflowRepo ?? context.repo)/g' add_workflow_run_comment.cjs
The same patch would be needed for add_comment.cjs, but the root cause should be fixed in the source.
Expected behavior
buildWorkflowRunUrl should receive invocation.workflowRepo (already resolved) instead of context.repo:
// Suggested fix in add_comment.cjs
const invocation = resolveInvocationContext(rawContext); // already called inside resolveEffectiveEventContext
const runUrl = buildWorkflowRunUrl(context, invocation.workflowRepo);
Or: expose workflowRepo from resolveEffectiveEventContext so callers don't need to call resolveInvocationContext twice.
Context
add_workflow_run_comment.cjs already does this correctly — it calls resolveInvocationContext(context).workflowRepo and passes the result to buildWorkflowRunUrl. add_comment.cjs should follow the same pattern.
resolveInvocationContext handles all three invocation styles (native, workflow_dispatch, repository_dispatch) and returns the correct workflowRepo in each case.
Reported by Claude Sonnet 4.6 while investigating footer URL regressions in a repository_dispatch-based workflow wrapper.
Bug Report
File:
actions/setup/js/add_comment.cjsSummary
add_comment.cjscallsresolveInvocationContext(rawContext)(viaresolveEffectiveEventContext, line ~53) to obtain aninvocationobject that includesinvocation.workflowRepo. However, when building the footer run URL further down, it usescontext.repodirectly instead ofinvocation.workflowRepo:The
invocation.workflowRepovalue is only used foreventNameandeventPayloadinsideresolveEffectiveEventContext— it is never propagated tobuildWorkflowRunUrl.Impact
In
repository_dispatch-triggered workflows that target a different repository than the one hosting the workflow,context.repois typically patched to the target repo so that safe-output actions (comments, labels, etc.) go to the right place.resolveInvocationContextcorrectly resolvesworkflowRepoas the original workflow repo in this scenario, but sinceadd_comment.cjsignores it and uses the patchedcontext.repoinstead, the{run_url}in comment footers points to the target repo rather than the workflow repo where the run actually lives.The existing workaround for the activation comment (
add_workflow_run_comment.cjs) is a runtimesedpatch:sed -i 's/buildWorkflowRunUrl(context, context\.repo)/buildWorkflowRunUrl(context, context.workflowRepo ?? context.repo)/g' add_workflow_run_comment.cjsThe same patch would be needed for
add_comment.cjs, but the root cause should be fixed in the source.Expected behavior
buildWorkflowRunUrlshould receiveinvocation.workflowRepo(already resolved) instead ofcontext.repo:Or: expose
workflowRepofromresolveEffectiveEventContextso callers don't need to callresolveInvocationContexttwice.Context
add_workflow_run_comment.cjsalready does this correctly — it callsresolveInvocationContext(context).workflowRepoand passes the result tobuildWorkflowRunUrl.add_comment.cjsshould follow the same pattern.resolveInvocationContexthandles all three invocation styles (native,workflow_dispatch,repository_dispatch) and returns the correctworkflowRepoin each case.Reported by Claude Sonnet 4.6 while investigating footer URL regressions in a
repository_dispatch-based workflow wrapper.