8000
Skip to content

fix: silently skip add_comment when no triggering context (schedule runs)#24098

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-safe-outputs-schedule-runs
Apr 2, 2026
Merged

fix: silently skip add_comment when no triggering context (schedule runs)#24098
pelikhan merged 2 commits intomainfrom
copilot/fix-safe-outputs-schedule-runs

Conversation

Copy link
Copy Markdown
Contributor
Copilot AI commented Apr 2, 2026

On schedule-triggered runs, status-comment: true generates an add_comment safe output with target: triggering, but there's no issue/PR context — causing safe_outputs to exit non-zero instead of skipping gracefully.

Root cause: resolveTarget() already returns { shouldFail: false } for this case, signaling "skip, don't fail." But add_comment.cjs ignored shouldFail and returned { success: false } without skipped: true, so the handler manager counted it as a real failure.

Fix (add_comment.cjs):

if (!targetResult.success) {
  if (targetResult.shouldFail) {
    core.warning(targetResult.error);
    return { success: false, error: targetResult.error };
  } else {
    // No triggering context (e.g. schedule run) — silently skip rather than fail
    core.info(targetResult.error);
    return { success: false, skipped: true, error: targetResult.error };
  }
}

The skipped: true flag is what the handler manager uses to distinguish an expected skip from a counted failure. Also switches from core.warning to core.info since this is not an error condition.

Test added: Schedule-event context with target: triggering now asserts result.skipped === true and that no core.warning is emitted for the skip message.

…xt on schedule runs

When target is 'triggering' but running in a non-issue/PR context (e.g. schedule),
resolveTarget returns shouldFail: false. Previously the handler returned
{ success: false } without skipped: true, causing the handler manager to count
it as a failure and exit non-zero.

Now, when shouldFail is false, we return { success: false, skipped: true } so the
handler manager treats it as an expected skip rather than a failure.

Fixes smoke-multi-pr failures on schedule runs caused by status-comment: true
generating add_comment with target: triggering.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/970c0b44-0e7f-4791-a736-472980d590ed

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Apr 2, 2026
Copilot AI changed the title [WIP] Fix safe_outputs failure on scheduled runs fix: silently skip add_comment when no triggering context (schedule runs) Apr 2, 2026
Copilot AI requested a review from pelikhan April 2, 2026 12:30
@pelikhan pelikhan marked this pull request as ready for review April 2, 2026 12:31
Copilot AI review requested due to automatic review settings April 2, 2026 12:31
@pelikhan pelikhan merged commit cf74ac7 into main Apr 2, 2026
114 of 163 checks passed
@pelikhan pelikhan deleted the copilot/fix-safe-outputs-schedule-runs branch April 2, 2026 12:31
Copy link
Copy Markdown
Contributor
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes add_comment safe output handling so schedule-triggered runs with target: triggering gracefully skip (instead of failing) when there’s no issue/PR context.

Changes:

  • Update add_comment.cjs to honor resolveTarget()’s shouldFail signal and return { skipped: true } for expected “no triggering context” cases.
  • Downgrade logging for this skip path from core.warning to core.info.
  • Add a regression test covering schedule context behavior for target: triggering.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
actions/setup/js/add_comment.cjs Uses shouldFail to distinguish between real failures vs expected skips; returns skipped: true for schedule/no-context runs.
actions/setup/js/add_comment.test.cjs Adds coverage asserting schedule-context + target: triggering yields skipped: true and no warning is emitted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[P1] Smoke Multi PR: safe_outputs fails on schedule runs (add_comment target:triggering)

3 participants

0