Skip to content

fix(enforce-single-assignee): comment when multiple owners#51

Merged
drewr merged 1 commit intomainfrom
fix-enforce-single-assignee
Mar 6, 2026
Merged

fix(enforce-single-assignee): comment when multiple owners#51
drewr merged 1 commit intomainfrom
fix-enforce-single-assignee

Conversation

@drewr
Copy link
Copy Markdown
Contributor

@drewr drewr commented Mar 6, 2026

Summary

Fixes a race condition in the enforce-single-assignee workflow.

Problem

As shown in #50, when multiple assignees are chosen simultaneously, GitHub fires one assigned event per person — each with a different github.event.assignee. Concurrent workflow runs each tried to keep their own "latest" assignee and remove the others, cancelling each other out and leaving nobody assigned.

Fix

  • Remove all assignees when more than one is detected
  • Post a comment listing who was attempted (as @mentions), asking the team to assign a single owner explicitly
  • Drop LATEST_ASSIGNEE — no longer making a guess about intent

Behavior

Assignees Before After
0–1 No action No action
2+ Remove all except github.event.assignee (racy) Remove all, post comment

Example comment posted to issue

Issues must have exactly one assignee, but 3 were assigned (@octocat, @hubot, @monalisa). All assignees have been removed. Please assign a single owner.

When multiple assignees are chosen simultaneously, GitHub fires one
`assigned` event per person with a different `assignee` each time.
Concurrent runs would race and cancel each other out, leaving nobody
assigned.

New behavior: remove all assignees and post a comment listing who was
attempted, asking the team to assign a single owner explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drewr drewr self-assigned this Mar 6, 2026
@drewr drewr merged commit f1f58f1 into main Mar 6, 2026
3 checks passed
@drewr drewr deleted the fix-enforce-single-assignee branch March 6, 2026 21:40
@drewr drewr changed the title Fix enforce-single-assignee: remove all and comment fix(enforce-single-assignee): comment when multiple owners Mar 6, 2026
drewr added a commit that referenced this pull request Mar 6, 2026
## Summary

Adds a concurrency group to the enforce-single-assignee workflow to
prevent duplicate comments when multiple assignees are added
simultaneously.

## Problem

As shown in #50 and #51, when multiple users are assigned at once,
GitHub fires one `assigned` event per user. Each concurrent workflow run
posted its own comment, resulting in duplicates.

## Fix

```yaml
concurrency:
  group: enforce-single-assignee-${{ github.event.issue.number }}
```

Runs are now serialized per issue. The first run removes all assignees
and posts one comment. Subsequent queued runs see 0 assignees and exit
immediately with no action.
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