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

feat: automatically fill closed or merged date in project #344

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

navinkarkera
Copy link
Contributor

Automatically adds closed/merged date to project item for a PR on close/merge.

Test instructions

  • Set GITHUB_PERSONAL_TOKEN=<your_token> and GITHUB_OSPR_PROJECT="openedx:19" environment variables.
  • Select a closed PR to test and make sure it has no value in Date merged/closed field in OSPR project board, you can use my PR
  • Get PR json using github cli, for example,
gh api \
-H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
/repos/openedx/edx-platform/pulls/35899 > /tmp/some.json
  • Update following lines in openedx_webhooks/tasks/pr_tracking.py to make the process faster.
Line 217 in `desired_support_state` function.
-    is_internal = is_internal_pull_request(pr)
+    is_internal = False
Line 273 in `desired_support_state` function.
-    has_signed_agreement = pull_request_has_cla(pr)
+    has_signed_agreement = True
  • Add below snippet to openedx_webhooks/tasks/pr_tracking.py file and execute it.
if __name__ == '__main__':
    import json
    with open('/tmp/some.json') as f:
        pr = json.load(f)
    fixer = PrTrackingFixer(pr, current_support_state(pr), desired_support_state(pr))
    fixer._fix_project_node_fields()
  • Verify that the Date merged/closed field info for the PR was added to OSPR board.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 14, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 14, 2025

Thanks for the pull request, @navinkarkera!

This repository is currently maintained by @feanil.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@navinkarkera navinkarkera marked this pull request as ready for review February 14, 2025 09:41
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.81%. Comparing base (1efb842) to head (8f36619).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
+ Coverage   89.72%   89.81%   +0.09%     
==========================================
  Files          38       38              
  Lines        3026     3054      +28     
  Branches      229      234       +5     
==========================================
+ Hits         2715     2743      +28     
  Misses        279      279              
  Partials       32       32              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mphilbrick211 mphilbrick211 requested a review from feanil February 14, 2025 22:16
"""
for project in self.current.github_projects_info:
if (
project["org"] == settings.GITHUB_OSPR_PROJECT[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

So the previous version of this would support having multiple desired projects that could be updated but it looks like now we're just hardcoding it so that even thought the setting is a list, we only accept the first item in the list as a valid project? Am I understanding this correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@feanil The previous version was also somewhat specific to the OSPR board as the fix_ospr function was only called for OSPRs. But this implementation makes sure that it is only applied to a single OSPR board as the field names are also hardcoded and are only available in OSPR board.

@navinkarkera navinkarkera force-pushed the navin/merged-closed-date branch from aeed55c to 07d2a61 Compare February 21, 2025 04:33
@navinkarkera navinkarkera force-pushed the navin/merged-closed-date branch from 07d2a61 to 01af195 Compare March 3, 2025 15:20
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

@navinkarkera I think this makes sense to me. Can you squash and cleanup your commits and I'll deploy to the staging environment, test and merge and deploy to production if it looks good.

@navinkarkera navinkarkera force-pushed the navin/merged-closed-date branch from 01af195 to 8f36619 Compare March 5, 2025 04:24
@navinkarkera
Copy link
Contributor Author

@feanil Done.

@feanil feanil merged commit befb79f into openedx:master Mar 5, 2025
6 checks passed
@feanil
Copy link
Contributor

feanil commented Mar 5, 2025

This is now deployed to production, Thanks @navinkarkera

@navinkarkera navinkarkera deleted the navin/merged-closed-date branch March 6, 2025 05:24
@itsjeyd
Copy link

itsjeyd commented Mar 6, 2025

Thanks a lot @navinkarkera and @feanil 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants