Claim bot: let me /unclaim my own issues (#1595)

An explicit /unclaim from the owner releases an owner-assigned issue; the sweep still never touches them.
This commit is contained in:
bherbruck authored and GitHub committed 2026-10-15 23:57:15 -04:00
1 parent 716107f0e4
commit fdb059cfed
2 files changed
+9 -6

No files matched your search

+2 -2
View File
@@ -223,8 +223,8 @@ async function unclaim(github, context) {
await react(github, context, '+1'); // nothing to release
return;
}
if (assignees.includes(context.repo.owner)) {
await react(github, context, 'eyes'); // never touched by the bot
if (assignees.includes(context.repo.owner) && user !== context.repo.owner) {
await react(github, context, 'eyes'); // only the owner releases their own issues
return;
}
const allowed = assignees.includes(user) || (await isMaintainer(github, context, user));
+7 -4
View File
@@ -170,10 +170,13 @@ test('unclaim by a maintainer releases, by a stranger does not', async () => {
assert.equal(find(w.calls, 'react')[1].content, 'eyes');
});
test('unclaim never touches an issue assigned to the owner', async () => {
const { github, calls } = fake();
await claim.handleComment({ github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
assert.equal(find(calls, 'removeLabel'), undefined);
test('unclaim on an owner-assigned issue works only for the owner', async () => {
let w = fake();
await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'carol', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
assert.equal(find(w.calls, 'removeLabel'), undefined);
w = fake();
await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
assert.ok(find(w.calls, 'removeLabel'));
});
const issue = (number, assignees = ['bob']) => ({