hiero-ledger / hiero-ledger/hiero-sdk-cpp
[Intermediate]: Split Large GitHub API Helper Module into Focused Helper Modules
- Dominant language
- C++
- Stars
- 42
- Forks
- 108
- Avg merge
- 11h 45m
- Merged PRs (30d)
- 2
Description
### 🧩 Intermediate Friendly
This issue is a good fit for contributors who are already familiar with the Hiero C++ SDK and feel comfortable navigating the codebase.
Intermediate Issues often involve:
- Exploring existing implementations
- Understanding how different components work together
- Making thoughtful changes that follow established patterns
The goal is to support deeper problem-solving while keeping the task clear, focused, and enjoyable to work on.
> [!IMPORTANT]
> ### 🧭 About Intermediate Issues
>
> Intermediate Issues are a great next step for contributors who enjoy digging into the codebase and reasoning about how things work.
>
> These issues often:
> - Involve multiple related files or components
> - Encourage investigation and understanding of existing behavior
> - Leave room for thoughtful implementation choices
> - Stay focused on a clearly defined goal
>
> Other kinds of contributions — from beginner-friendly tasks to large system-level changes — are just as valuable and use different labels.
### 👾 Description of the Task
The current GitHub API helper file has grown into a large shared module containing many unrelated responsibilities, including:
- Context building
- Label management
- Comment handling
- Pull request fetching
- Issue fetching
- Status label swapping
- Linked issue resolution
- Assignment counting
- Workflow helper logic
This makes the automation harder to maintain and harder to migrate into a reusable app or package because unrelated logic is tightly coupled within a single file.
## Relevant Files
### Current Helper Modules
- `.github/scripts/helpers/api.js`
- `.github/scripts/helpers/index.js`
- `.github/scripts/helpers/comments.js`
- `.github/scripts/helpers/checks.js`
### Related Tests
- `.github/scripts/tests/test-api.js`
- `.github/scripts/tests/test-assign-bot.js`
- `.github/scripts/tests/test-on-pr-open-bot.js`
- `.github/scripts/tests/test-on-pr-update-bot.js`
### 💡 Proposed Approach
Split `helpers/api.js` into smaller modules organized by responsibility.
### Suggested Structure
```text
.github/scripts/helpers/context.js
.github/scripts/helpers/labels.js
.github/scripts/helpers/issue-comments.js
.github/scripts/helpers/issues.js
.github/scripts/helpers/pull-requests.js
.github/scripts/helpers/assignment-queries.js
.github/scripts/helpers/status-labels.js
```
Keep `helpers/index.js` as the public export surface so existing bot scripts can be migrated gradually without creating large import churn across the repository.
### 👩💻 Implementation Steps
- [ ] Group functions in `api.js` by responsibility
- [ ] Create focused helper modules for each responsibility group
- [ ] Re-export helpers through `helpers/index.js`
- [ ] Update imports only where needed
- [ ] Keep function names and behavior stable where possible
- [ ] Update tests to target the new helper modules
- [ ] Run lint checks and existing bot script tests
### ✔️ Acceptance Criteria
- [ ] `helpers/api.js` is split into focused modules
- [ ] Existing bot behavior remains unchanged
- [ ] Existing tests continue to pass
- [ ] Public helper exports remain easy for bot scripts to consume
- [ ] The new module boundaries make the code easier to reuse in a future automation package
---
### 📋 Step-by-Step Contribution Guide
To help keep contributions consistent and easy to review, we recommend following these steps:
- [ ] Comment `/assign` to request the issue
- [ ] Wait for assignment
- [ ] Fork the repository and create a branch
- [ ] Set up the project using the instructions in `README.md`
- [ ] Make the requested changes
- [ ] Sign each commit using `-s -S`
- [ ] Push your branch and open a pull request
Read [Workflow Guide](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/docs/training/workflow.md) for step-by-step workflow guidance.
Read [README.md](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/README.md) for setup instructions.
❗ Pull requests **cannot be merged** without `S` and `s` signed commits.
See the [Signing Guide](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/docs/training/signing.md).
### 🤔 Additional Information
This is a maintainability-only refactor. It should avoid changing business rules, labels, permissions, comments, or workflow behavior.
Contributor guide
Research direction
Start by grouping the responsibilities in .github/scripts/helpers/api.js and reviewing the exports in helpers/index.js, then read test-api.js and the listed bot tests. Split the helpers into the proposed modules while preserving names, exports, and behavior. Done means the existing bot tests and lint checks pass with helpers/index.js remaining the public export surface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, javascript
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100