Skip to content

[Bug]: label-sync should not fail when a PR has no linked issue #157

@coisa

Description

@coisa

Summary

The label-sync workflow can fail when a pull request does not reference any linked issue in its title or body.

Current Behavior

The composite action .github/actions/label-sync/copy-linked-issue-labels parses the pull request title/body with a grep pipeline inside command substitution while running under set -euo pipefail.

When no linked issue keyword such as closes #123 or fixes #123 is present, grep exits with status 1 before the script reaches the explicit fallback branch that should print No linked issue was found... and exit successfully.

That makes the workflow fail even though the absence of a linked issue should be treated as a no-op.

Failing Surface

  • .github/workflows/label-sync.yml
  • .github/actions/label-sync/copy-linked-issue-labels/run.sh

Observed failure:

Prepare all required actions
Run ./.github/actions/label-sync/copy-linked-issue-labels
Run /home/runner/work/dev-tools/dev-tools/./.github/actions/label-sync/copy-linked-issue-labels/run.sh
/home/runner/work/dev-tools/dev-tools/./.github/actions/label-sync/copy-linked-issue-labels/run.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  GH_TOKEN: ***

Expected Behavior

  • If the PR body/title does not reference any issue, the action should log that no linked issue was found and exit with status 0.
  • The workflow should only attempt label propagation when a linked issue number is actually present.

Acceptance Criteria

  • copy-linked-issue-labels no longer fails when the PR has no linked issue reference.
  • The action still copies labels correctly when an issue reference exists.
  • A regression test or equivalent focused verification covers the no-linked-issue path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Released

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions