Skip to content

feat: automated docs code improvement pipeline #77

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ A Node.js server for GitHub app to assist external contributors and save maintai
- [ ] On `integrations-config` PR merge, psot a comment to join Slack's product-releases channel to get notified when that integration goes live
- [ ] On `integrations-config` PR merge, post a comment to raise PR in `rudder-docs`
- [x] List of open PRs by external contributors
- [ ] Automated docs/code improvement pipeline
- [ ] Configuration page or a labelled gh issue - directory/filename, no. of tiny PRs per week, no. of big PRs every month, changes per file
- [ ] Review files based on configurations, prioritize, and create issues with instructions for the change
- [ ] On issue approval (label change), execute the task (the code change), and raise PR

## Requirements

Expand Down
97 changes: 97 additions & 0 deletions src/docs-action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/**
* Automated action to improve docs
*/

/**
* Scan files under a directory in a repo to find files that need to be improved
* Returns the list of files that need to be improved
* A recurring task that initiates the docs improvement pipeline
* Triggered by: Schedule (every week)
* @param {string} owner
* @param {string} repo
* @returns {Promise<String[]>} list of files
*/
async function scan(owner, repo) {
console.log("Scanning configuration for improvement scope and opportunities");
// Get the list of files that need improvement as per master configuration
}

/**
* Creates an actionable issue for the improvement of particular docs page
* Triggered by: Scan
* @param {string} owner
* @param {string} repo
* @param {string[]} files - The list of files to improve
*/
async function reviewAndPrioritize(owner, repo, files) {
console.log("Reviewing and prioritizing the docs pages for improvement in "+ files.join(", "));
// Get the file content
// Call the ai review + prioritize endpoint
// Create a new issue with the results
}

/**
* Get the list of active docs improvement tasks
* @param {string} owner
* @param {string} repo
* @returns {Promise<Issue[]>} list of issues
*/
async function getActiveDocsImprovementTasks(owner, repo) {
// Get the list of issues that are related to the improvement of a docs page
// Make sure we have their labels and status
}

/**
* Create a new issue in Github
* @param {string} owner
* @param {string} repo
* @param {string} path
* @param {string} title
* @param {string} body
*/
async function createIssue(owner, repo, path, title, body) {

}

/**
*
* @param {string} owner
* @param {string} repo
* @param {string} issue
*/
async function onIssueLabelChange(owner, repo, issue) {
// Verify that the issue is related to the improvement of a docs page
// Verify that the issue is approved to be processed
// Extract the filepath and the instructions from the issue title and body and comment on the issue with the results
// Trigger file edit
// Update the issue status to "In Progress"
}


/**
* Edit a file in the repo
* Triggered by: Issue label change
* @param {string} owner
* @param {string} repo
* @param {string} filepath
* @param {string} content
*/
async function editFile(owner, repo, filepath, content, issue) {
// Call the ai edit endpoint
// Create a new branch
// Commit the changes in the file
// Create a PR
// Link the PR to the issue
}

/**
* Find issues related to the improvement of a particular file
* @param {string} owner
* @param {string} repo
* @param {string} filepath
* @returns {Promise<Issue[]>} list of issues
*/
async function findRelatedIssues(owner, repo, filepath) {
// Get the list of issues that are related to the improvement of the file
// Make sure we have their labels and status
}