-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
There are several inefficiencies in the current GitHub automation script that need to be optimized for better performance and reliability:
- Inefficient Open PR Check (anyOpenPR)
- Currently, the script fetches all pull requests and iterates through them to find an open PR.
Suggested Fix: Use
repo.get_pulls(state='open', head=BRANCH_NAME)instead to fetch only relevant PRs.
- Creating Duplicate Branches
- The script checks if a branch exists by iterating through all branches, which is inefficient for large repositories.
Suggested Fix: Use
repo.get_branch(BRANCH_NAME)and handle exceptions if the branch does not exist.
- Inefficient PR Status Fetching (printPRStatus)
- The script finds the highest issue/PR number instead of retrieving the latest PR efficiently.
Suggested Fix: Use
repo.get_pulls(state='open', sort='created', direction='desc')to fetch the latest PR.
- Excessive time.sleep(4) Delay
- The script waits for 4 seconds before checking PR status, which is arbitrary and may be unnecessary.
Suggested Fix: Implement a retry mechanism with exponential backoff instead of using a static sleep time.
- Non-Standard Exit Codes
- The script exits with exit(0) even in failure cases, which incorrectly signals success.
Suggested Fix: Use
exit(1)for errors to properly indicate failure cases.
- STUDY_NAME Should Be Replaced STUDY_NAME_PATH With In checkInputValidity()
Metadata
Metadata
Assignees
Labels
No labels