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

Add New Module for Project Maintenance Automation (adding tracking issues to multiple repos) #815

Merged
merged 4 commits into from
Jan 16, 2024

Conversation

nonprofittechy
Copy link
Member

@nonprofittechy nonprofittechy commented Jan 16, 2024

Fix #746

Overview

This PR introduces a new module project_maintenance.py designed to help you automate creating a tracking issue across multiple repositories. It also lets you automatically make a card for the issue on a GitHub next generation project board. Finally, it assists with adding a topic to a github repositories based on their presence on the /list?json=1 endpoint on a given Docassemble server. This topic can later be used to decide which repos need tracking issues to be created for them.

Features

  • Get Package Names: Fetch package names from a specified Docassemble server.
  • Add Tag to Repositories: Add a specific tag to repositories within a GitHub organization.
  • Process Packages and Add Tag: Combine fetching package names and adding tags into a single process.
  • Add Issues and Create Cards in Next-Generation Projects: For each repository with a given topic, create issues and link them as cards to a specified classic project.
  • Link Issue Titles to Projects: Link issues with a specific title in repositories (filtered by topic) to a Next-Generation project.

Usage

This module should be run locally for now. A future task could be to make a user-friendly way to run this via GitHub actions, but it seems it would need a full GUI. Probably commandline usage is enough.

Before using the module, ensure PyGithub is installed.

Command Line Interface

The module can be used via the command line with various subcommands:

  • Get Package Names

    • server_name: Name or IP address of the Docassemble server.
  • Add Tag to Repos

    • token: GitHub Personal Access Token (PAT) with appropriate permissions.
    • org_name: Name of the GitHub organization.
    • repo_names: List of repository names to which the tag will be added.
    • tag: The tag to be added to the repositories.
  • Process Packages and Add Tag

    • server_name: Name or IP address of the Docassemble server.
    • token: GitHub Personal Access Token.
    • org_name: Name of the GitHub organization.
    • tag: Tag to be added to each repository.
  • Add Issues and Create Classic Cards

    • token: GitHub Personal Access Token.
    • org_name: Name of the GitHub organization.
    • project_name: Name of the GitHub project.
    • topic: The GitHub topic to filter repositories by.
    • issue_title: Title of the issue.
    • issue_body: Body of the issue.
  • Add Issues and Create Cards (Next-Generation Projects)

    • token: GitHub Personal Access Token.
    • org_name: Name of the GitHub organization.
    • project_name: Name of the GitHub project.
    • topic: The GitHub topic to filter repositories by.
    • issue_title: Title of the issue.
    • issue_body: Body of the issue.
  • Link Issue Titles to Projects

    • token: GitHub Personal Access Token.
    • org_name: Name of the GitHub organization.
    • project_name: Name of the GitHub project.
    • topic: GitHub topic to filter repositories by.
    • issue_title: Title of the issue to link.

Example usage

python docassemble/AssemblyLine/project_maintenance.py add_issues_and_create_cards ghp_... SuffolkLITLab "Add metadata to each live interview" live "Add courtformsonline.org metadata" "Add the metadata needed to work with the new courtformsonline.org repo scanning tool"

@nonprofittechy nonprofittechy merged commit f3ec875 into main Jan 16, 2024
4 of 5 checks passed
@nonprofittechy nonprofittechy deleted the automate-maintenance-tasks branch January 16, 2024 02:51
@BryceStevenWilley
Copy link
Contributor

This looks super cool! I was wondering how you were making all of those issues and linking them to projects so quickly!

I think you'll also want to add PyGitHub to the setup.py install_requires, or maybe have this in another repo, like the Dashboard. Otherwise DA will try to run the module on restart, and it'll error in the logs if folks don't have PyGitHub installed (if they don't have the GithubFeedback package I think).

@nonprofittechy
Copy link
Member Author

I think I'll just turn off pre-load for this module since it's meant to run in the command line, but good point.

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.

Create a way to open a project that lists a chore for every live repo
2 participants