mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Add /unassign support (#20864)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2e1efaebe4
commit
48412a068e
42
.github/workflows/gemini-self-assign-issue.yml
vendored
42
.github/workflows/gemini-self-assign-issue.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
if: |-
|
if: |-
|
||||||
github.repository == 'google-gemini/gemini-cli' &&
|
github.repository == 'google-gemini/gemini-cli' &&
|
||||||
github.event_name == 'issue_comment' &&
|
github.event_name == 'issue_comment' &&
|
||||||
contains(github.event.comment.body, '/assign')
|
(contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/unassign'))
|
||||||
runs-on: 'ubuntu-latest'
|
runs-on: 'ubuntu-latest'
|
||||||
steps:
|
steps:
|
||||||
- name: 'Generate GitHub App Token'
|
- name: 'Generate GitHub App Token'
|
||||||
@@ -38,6 +38,7 @@ jobs:
|
|||||||
permission-issues: 'write'
|
permission-issues: 'write'
|
||||||
|
|
||||||
- name: 'Assign issue to user'
|
- name: 'Assign issue to user'
|
||||||
|
if: "contains(github.event.comment.body, '/assign')"
|
||||||
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
||||||
with:
|
with:
|
||||||
github-token: '${{ steps.generate_token.outputs.token }}'
|
github-token: '${{ steps.generate_token.outputs.token }}'
|
||||||
@@ -108,3 +109,42 @@ jobs:
|
|||||||
issue_number: issueNumber,
|
issue_number: issueNumber,
|
||||||
body: `👋 @${commenter}, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our [contributing guidelines](https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md).`
|
body: `👋 @${commenter}, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our [contributing guidelines](https://github.com/google-gemini/gemini-cli/blob/main/CONTRIBUTING.md).`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
- name: 'Unassign issue from user'
|
||||||
|
if: "contains(github.event.comment.body, '/unassign')"
|
||||||
|
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
||||||
|
with:
|
||||||
|
github-token: '${{ steps.generate_token.outputs.token }}'
|
||||||
|
script: |
|
||||||
|
const issueNumber = context.issue.number;
|
||||||
|
const commenter = context.actor;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const commentBody = context.payload.comment.body.trim();
|
||||||
|
|
||||||
|
if (commentBody !== '/unassign') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const issue = await github.rest.issues.get({
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
});
|
||||||
|
|
||||||
|
const isAssigned = issue.data.assignees.some(assignee => assignee.login === commenter);
|
||||||
|
|
||||||
|
if (isAssigned) {
|
||||||
|
await github.rest.issues.removeAssignees({
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
assignees: [commenter]
|
||||||
|
});
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: owner,
|
||||||
|
repo: repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body: `👋 @${commenter}, you have been unassigned from this issue.`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,11 +75,14 @@ Replace `<PR_NUMBER>` with your pull request number. Authors are encouraged to
|
|||||||
run this on their own PRs for self-review, and reviewers should use it to
|
run this on their own PRs for self-review, and reviewers should use it to
|
||||||
augment their manual review process.
|
augment their manual review process.
|
||||||
|
|
||||||
### Self assigning issues
|
### Self-assigning and unassigning issues
|
||||||
|
|
||||||
To assign an issue to yourself, simply add a comment with the text `/assign`.
|
To assign an issue to yourself, simply add a comment with the text `/assign`. To
|
||||||
The comment must contain only that text and nothing else. This command will
|
unassign yourself from an issue, add a comment with the text `/unassign`.
|
||||||
assign the issue to you, provided it is not already assigned.
|
|
||||||
|
The comment must contain only that text and nothing else. These commands will
|
||||||
|
assign or unassign the issue as requested, provided the conditions are met
|
||||||
|
(e.g., an issue must be unassigned to be assigned).
|
||||||
|
|
||||||
Please note that you can have a maximum of 3 issues assigned to you at any given
|
Please note that you can have a maximum of 3 issues assigned to you at any given
|
||||||
time.
|
time.
|
||||||
|
|||||||
Reference in New Issue
Block a user