Skip to content

Commit

Permalink
Merge pull request #1319 from szemek/delete_workflow_run
Browse files Browse the repository at this point in the history
Add delete_workflow_run method to Octokit::Client::ActionsWorkflowRuns module
  • Loading branch information
tarebyte authored Jan 28, 2021
2 parents 06fd525 + 71b4a7d commit 6df1ed8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/octokit/client/actions_workflow_runs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ def cancel_workflow_run(repo, id, options = {})
boolean_from_response :post, "#{Repository.path repo}/actions/runs/#{id}/cancel", options
end

# Deletes a workflow run
#
# @param repo [Integer, String, Repository, Hash] A GitHub repository
# @param id [Integer] Id of a workflow run
#
# @return [Boolean] Returns true if the run is deleted
# @see https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run
def delete_workflow_run(repo, id, options = {})
boolean_from_response :delete, "#{Repository.path repo}/actions/runs/#{id}", options
end

# Get a download url for archived log files of a workflow run
#
# @param repo [Integer, String, Repository, Hash] A GitHub repository
Expand Down
10 changes: 10 additions & 0 deletions spec/octokit/client/actions_workflow_runs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@
end
end

describe '.delete_workflow_run' do
it 'deletes the workflow run' do
request = stub_delete("repos/#{@test_repo}/actions/runs/#{@run_id}")

response = @client.delete_workflow_run(@test_repo, @run_id)

assert_requested request
end
end

describe '.workflow_run_logs' do
it 'returns the location of the workflow run logs' do
request = stub_head("repos/#{@test_repo}/actions/runs/#{@run_id}/logs")
Expand Down

0 comments on commit 6df1ed8

Please sign in to comment.