Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic unassign for stale issues #2986

Closed
wants to merge 8 commits into from
Closed

Conversation

Azanul
Copy link

@Azanul Azanul commented Oct 15, 2022

Added 2 github actions:

  1. Labels all issues inactive for 14 days as "stale"
  2. Unassigns an issue whenever it is labeled as "stale"

Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
@welcome
Copy link

welcome bot commented Oct 15, 2022

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@Azanul
Copy link
Author

Azanul commented Oct 15, 2022

@samhita-alla Check it out and let me know if I've missed anything.

Review changes

Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
echo "Unassigning issue ${{ github.event.issue.number }}"
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"assignees": []}' \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this works?

Copy link
Contributor

@samhita-alla samhita-alla Oct 31, 2022

Choose a reason for hiding this comment

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

@Azanul where is {{ github.event.issue.assignee }} documented in GitHub docs? I want to make sure this works.

@samhita-alla
Copy link
Contributor

@Azanul, can you work on my suggestions so that I can merge this PR?

Azanul and others added 4 commits October 28, 2022 16:26
Co-authored-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
Co-authored-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
Co-authored-by: Samhita Alla <aallasamhita@gmail.com>
Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
@Azanul
Copy link
Author

Azanul commented Oct 31, 2022

@samhita-alla go to https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
check the entry for github.event , it says:-

This object is identical to the webhook payload of the event that triggered the workflow run, and is different for each event.

Now checkout the webhook payload of issues event.

@samhita-alla
Copy link
Contributor

@Azanul, thanks! Will this work if there are multiple assignees?

@Azanul
Copy link
Author

Azanul commented Oct 31, 2022

@Azanul, thanks! Will this work if there are multiple assignees?

For handling multiple assignees, I'll have to use issues.assignees and fetch login value of each object to put in the array. I reckoned from here that you might not want handling of multiple assignees, so I didn't do it.

@samhita-alla
Copy link
Contributor

Oh, I meant I don't want to block assigning an issue to multiple people. But if we're going to unassign after the issue goes stale, unassigning all of them makes sense, right?

Signed-off-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
@Azanul
Copy link
Author

Azanul commented Oct 31, 2022

Oh, I meant I don't want to block assigning an issue to multiple people. But if we're going to unassign after the issue goes stale, unassigning all of them makes sense, right?

Done, for multiple assignees

@github-actions github-actions bot added the stale label Sep 5, 2023
@github-actions github-actions bot closed this Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants