-
Notifications
You must be signed in to change notification settings - Fork 21
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
Added logic to check if a contributor has already contributed to good first issue #28
base: main
Are you sure you want to change the base?
Conversation
action.yml
Outdated
@@ -37,6 +42,18 @@ runs: | |||
using: "composite" | |||
steps: | |||
- run: | | |||
check_if_contributed_to_good_first_issue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor (blocking): for the good first issue check, all that needs to be checked is if they've ever contributed to the repository, regardless of the labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like this make sense:
check_if_contributed_to_repository() {
local assignee="$1"
local response=$(curl -s -H "Authorization: token $GITHUB_PAT" "https://api.github.com/search/issues?q=is:pr+author:$assignee")
local total_count=$(echo "$response" | jq -r '.total_count')
if [ "$total_count" -gt 0 ]; then
echo "true"
else
echo "false"
fi
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks all issues. What I'd suggest is not even PRs or issues. If they have at least one commit in the given project, that disqualifies them from contributing to a good first issue.
Here's a rough example care of ChatGPT (don't necessarily trust it)
# Set your GitHub username, repository name, owner username, and access token
USERNAME="your_username"
REPO="repository_name"
OWNER="repository_owner_username"
ACCESS_TOKEN="your_access_token"
# Make a cURL request to list commits in the repository by the specified user
curl -H "Authorization: token $ACCESS_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$OWNER/$REPO/commits?author=$USERNAME"
# You can filter the response to check if the user has commits
# For example, you can use 'jq' to parse JSON response and count the number of commits
# Ensure you have 'jq' installed: https://stedolan.github.io/jq/download/
# Example:
# curl -H "Authorization: token $ACCESS_TOKEN" \
# -H "Accept: application/vnd.github.v3+json" \
# "https://api.github.com/repos/$OWNER/$REPO/commits?author=$USERNAME" | jq '. | length'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this makes sense. Thanks for clarifying, I will try to take a look over the weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No rush @Haimantika, and thanks again for tackling this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nickytonline do we want to make changes to the workflow? Or the action? Like I did a test here - Haimantika/test_repo#6 with updated workflow and it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nickytonline any comments on it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Haimantika, thanks again for working on this. I haven't had a chance to look at this yet as I'm deep in feature work currently for OpenSauced. I'm going to carve out some time for this in the next couple of weeks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nickytonline ping on this - hoping you could take a look at it sometime in this month 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Haimantika, apologies, work has been busy and this went by the wayside.
I'm going to take a peek at this on Monday.
Closes #26.