feat: Add github.getWorkflowUsage component for Actions billing#3158
feat: Add github.getWorkflowUsage component for Actions billing#3158forestileao merged 8 commits intosuperplanehq:mainfrom
Conversation
Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
9d34ab2 to
c4e3b0f
Compare
|
@AleksandarCole can you please review ? |
|
Moved to code review |
|
@samuel-asleep I saw you didn't add anything on de frontend side, please create a mapper and validate your implementation based on https://github.com/superplanehq/superplane/blob/main/docs/contributing/component-design.md |
…ions with frontend mapper Signed-off-by: Akinniranye Samuel Tomiwa <benneu40@gmail.com>
ChangesUse
Extract helper functions to improve modularity
Execute() reduced from ~90 lines to ~40 lines of orchestration logic. Before: // Setup had nested loops with manual found flag
for _, repoName := range config.Repositories {
found := false
for _, availableRepo := range appMetadata.Repositories {
if availableRepo.Name == repoName {
selectedRepos = append(selectedRepos, ...)
found = true
break
}
}
if !found { return error }
}After: // Setup uses extracted helper with slices.IndexFunc
selectedRepos, err := validateAndCollectRepositories(ctx, config.Repositories)
// In helper:
repoIndex := slices.IndexFunc(appMetadata.Repositories, func(r Repository) bool {
return r.Name == repoName
})
2026-02-18.02-21-12.mp4 |
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
|
Thanks for the updates @forestileao, I appreciate the improvements 🙌 |
|
@samuel-asleep I made some updates myself related to formatting and name patterns. Thanks for your contributions, be free to claim your bounty. |
🤖 Professional AI Solution (Claude Sonnet 4.6)pkg/integrations/github/
|
OverviewThis PR adds a new
|
This pull request adds a new "Get Workflow Usage" component to the GitHub integration, allowing users to retrieve detailed, billable GitHub Actions usage data for their organization. It includes both backend implementation and documentation, updates the required permissions, and enhances repository resource listing to ensure accuracy. Comprehensive tests are also provided to verify the new functionality.
New "Get Workflow Usage" Component:
GetWorkflowUsageinpkg/integrations/github/get_workflow_usage.go, which retrieves and aggregates GitHub Actions usage (billable minutes) for the organization, supports optional repository filtering, and outputs detailed breakdowns by runner/OS. Also stores selected repository metadata for workflow display.pkg/integrations/github/get_workflow_usage_example_output.json.pkg/integrations/github/github.go).pkg/integrations/github/get_workflow_usage_test.go.Documentation Updates:
docs/components/GitHub.mdx, describing prerequisites, use cases, configuration, output, and references.Integration and Permissions Enhancements:
pkg/integrations/github/list_resources.goto fetch the latest accessible repositories directly from the GitHub API, ensuring up-to-date options for users. [1] [2]video
2026-02-18.02-21-12.mp4