-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Actions API endpoints for workflow run and job management #35382
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
rossigee
wants to merge
10
commits into
go-gitea:main
Choose a base branch
from
rossigee:feature/runner-logs-api-endpoint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Actions API endpoints for workflow run and job management #35382
rossigee
wants to merge
10
commits into
go-gitea:main
from
rossigee:feature/runner-logs-api-endpoint
+1,603
−203
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Addresses #35176 |
Please be aware existing Gitea workflow api do not use runindex, also jobs use jobid instead of jobindex. GET /actions/runs/{run}/jobs/{job_id}/logs - Download job logs Line 1210 in d2f2221
|
Implements comprehensive REST API endpoints for GitHub Actions workflow runs: - POST /actions/runs/{run}/rerun - Rerun entire workflow run - POST /actions/runs/{run}/cancel - Cancel running workflow - POST /actions/runs/{run}/approve - Approve workflow requiring approval - POST /actions/runs/{run}/jobs/{job_id}/rerun - Rerun specific job - GET /actions/runs/{run}/logs - Download run logs archive - GET /actions/runs/{run}/jobs/{job_id}/logs - Download job logs - POST /actions/runs/{run}/logs - Stream logs with cursor support Features: - Proper permission checks and workflow validation - Support for "latest" run parameter - Job dependency handling for reruns - Streaming log API with cursor-based pagination - Comprehensive test coverage Fixes workflow management gaps in API compatibility.
…cate endpoint Based on reviewer feedback, this commit makes the following changes: ## API Consistency Improvements - Replace getRunIndex() with getRunID() to align with existing Gitea API patterns - Update all endpoints to use run ID directly instead of run index - Follow the same pattern as GetWorkflowRun(): runID := ctx.PathParamInt64("run") and db.GetByID[actions_model.ActionRun](ctx, runID) - Update swagger documentation to reflect "run ID" instead of "run number" ## Remove Duplicate Endpoint - Remove GetWorkflowJobLogs function and corresponding route /actions/runs/{run}/jobs/{job_id}/logs - This eliminates duplication with existing /actions/jobs/{job_id}/logs endpoint - Remove corresponding test TestAPIActionsGetWorkflowJobLogs ## Functions Updated - RerunWorkflowRun: now uses run ID consistently - CancelWorkflowRun: now uses run ID consistently - ApproveWorkflowRun: now uses run ID consistently - RerunWorkflowJob: now uses run ID consistently - GetWorkflowRunLogs: now uses run ID consistently - GetWorkflowRunLogsStream: now uses run ID consistently ## Helper Functions Refactored - getRunIndex() → getRunID() with proper error handling - getRunJobsByIndex() → getRunJobsByRunID() with proper validation - getRunJobsAndCurrent() updated to use run ID parameter All existing tests continue to pass as they were already using run IDs correctly.
d8ca88a
to
f2cf2e6
Compare
Comments addressed. Please re-review. |
CI failure is still related. |
Initial implementation of linked proposal. * Closes go-gitea#29942 * Fix go-gitea#34003 * Fix go-gitea#30443 --------- Co-authored-by: silverwind <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
…epository (go-gitea#35511) Extracted from go-gitea#35077 `UpdateRef` and `RemoveRef` will call git commands even for gogit version.
Implements comprehensive REST API endpoints for GitHub Actions workflow runs: - POST /actions/runs/{run}/rerun - Rerun entire workflow run - POST /actions/runs/{run}/cancel - Cancel running workflow - POST /actions/runs/{run}/approve - Approve workflow requiring approval - POST /actions/runs/{run}/jobs/{job_id}/rerun - Rerun specific job - GET /actions/runs/{run}/logs - Download run logs archive - GET /actions/runs/{run}/jobs/{job_id}/logs - Download job logs - POST /actions/runs/{run}/logs - Stream logs with cursor support Features: - Proper permission checks and workflow validation - Support for "latest" run parameter - Job dependency handling for reruns - Streaming log API with cursor-based pagination - Comprehensive test coverage Fixes workflow management gaps in API compatibility.
This commit adds comprehensive REST API endpoints for GitHub Actions workflow run and job operations, addressing requirements for: - Workflow run operations: approve, cancel, rerun - Job-specific operations: rerun individual jobs - Log streaming: both archive download and incremental streaming - Enhanced job log access with proper error handling Key changes: - Add 6 new API endpoints in actions_run.go using consistent run ID approach - Add comprehensive integration tests with proper error scenarios - Update Swagger documentation for all new endpoints - Maintain backward compatibility with existing API patterns All endpoints follow established authentication and authorization patterns, with proper error handling and response formatting.
- Keep GetWorkflowJobLogs function and grouped job endpoints - Use map[string]any consistently for modern Go style - Maintain all functionality from both branches
This commit adds comprehensive REST API endpoints for GitHub Actions workflow run and job operations, addressing requirements for: - Workflow run operations: approve, cancel, rerun - Job-specific operations: rerun individual jobs, download job logs - Log streaming: both archive download and incremental streaming - Enhanced job log access with proper error handling Key changes: - Add 6 new API endpoints in actions_run.go using consistent run ID approach - Add comprehensive integration tests with proper error scenarios - Update Swagger documentation for all new endpoints - Maintain backward compatibility with existing API patterns All endpoints follow established authentication and authorization patterns, with proper error handling and response formatting.
…e/gitea into feature/runner-logs-api-endpoint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
modifies/api
This PR adds API routes or modifies them
modifies/go
Pull requests that update Go code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements comprehensive REST API endpoints for GitHub Actions workflow runs:
Features:
Fixes workflow management gaps in API compatibility.