Skip to content

Conversation

@iamshobhraj
Copy link
Contributor

Description

Add GitHub Actions workflow to automatically manage the "community-contribution-in-progress" label on issues based on external contributor assignments. This PR adds both the workflow configuration and the label management script.

Issue addressed

Addresses learningequality/kolibri#12923

Changelog

Steps to test

  1. Set up a repository to call this reusable workflow
  2. Assign an issue to an external contributor
    • Verify the label is automatically added
  3. Unassign the issue
    • Verify the label is automatically removed
  4. Test with internal contributors
    • Verify the label behavior is correct

(optional) Implementation notes

At a high level, how did you implement this?

This PR adds:

  1. A reusable GitHub Actions workflow (community-contribution-label.yml)
  2. A Python script to handle the label management logic (community-contribution-label.py)

The workflow:

  • Is triggered as a reusable workflow
  • Uses Python to interact with GitHub API
  • Manages labels based on assignee status (internal/external)

The script:

  • Checks if issue assignees are external contributors
  • Adds/removes the 'community-contribution-in-progress' label accordingly
  • Handles GitHub API interactions securely

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included (N/A)
  • Critical and brittle code paths are covered by unit tests
  • The change is described in the changelog section above

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

After review

  • The changelog item has been pasted to the CHANGELOG.md

Comments

@MisRob MisRob requested review from MisRob and rtibbles January 21, 2025 19:08
@MisRob
Copy link
Member

MisRob commented Jan 22, 2025

Thank you, @iamshobhraj, we will review.

Following-up on your comment

Since I had to use this GitHub Action in my personal repository, I created and used GitHub tokens. For the organization, we'll need to ensure we have a similar token set up if it isn’t already covered.

I think this @rtibbles's guidance from another pull request should be relevant

For the Github token, we will be using the LE Github App for authentication. You can see how we use the token generation action by tibdex here: https://github.com/learningequality/kolibri/blob/develop/.github/workflows/update_h5p.yml#L84 to use those secrets to generate a token we can use for Github authentication.

@iamshobhraj
Copy link
Contributor Author

@MisRob i added the tidbex token generation, but i dont know if the token generated will have the permissions needed to add label to issues and read collaborators from the repository.

@MisRob
Copy link
Member

MisRob commented Jan 23, 2025

Thanks @iamshobhraj, we will test that and follow-up

Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

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

Hi @iamshobhraj, thanks a lot! I reviewed as best as I could and left few minor notes. Overall it looks very well to me. I will now invite @rtibbles whose skills with actions and Python are much better than mine. After he confirms it's good to go, we will merge and I will test it in our environment.

if action == "assigned" and has_external_assignee:
add_label(owner, repo_name, issue_number, token)
elif action == "unassigned" and not has_external_assignee:
remove_label(owner, repo_name, issue_number, token)
Copy link
Member

Choose a reason for hiding this comment

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

Here I appreciated that you thought of looping all assigneess, and removing the label only when none of them is external.

@iamshobhraj iamshobhraj requested a review from MisRob February 7, 2025 14:06
@iamshobhraj
Copy link
Contributor Author

iamshobhraj commented Feb 8, 2025

@MisRob Thanks for reviewing the pr, I have made the changes you requested.

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

A couple of tweaks - mostly to make sure we're not running this unnecessarily or setting it up wrongly in other repos.

@iamshobhraj iamshobhraj requested a review from rtibbles February 11, 2025 19:53
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

This looks good to go to me.

@MisRob
Copy link
Member

MisRob commented Feb 25, 2025

Thank you @iamshobhraj. I will merge now and spend some time testing via test-actions. If I discover any trouble, we can chat here.

@MisRob MisRob merged commit 875a39c into learningequality:main Feb 25, 2025
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.

3 participants