From 78dfc53095e6d08ed5e980795c789a285ed37b89 Mon Sep 17 00:00:00 2001 From: Pablo Perez Schroder Date: Tue, 9 Jun 2020 16:20:11 +0200 Subject: [PATCH 1/4] Add DeleteDeployment for Repositories --- github/repos_deployments.go | 12 ++++++++++++ github/repos_deployments_test.go | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/github/repos_deployments.go b/github/repos_deployments.go index 57de0a22692..3caa9730e8a 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -129,6 +129,18 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo return d, resp, nil } +// DeleteDeployment deletes an existing deployment for a repository. +// +// GitHub API docs: https://developer.github.com/v3/repos/deployments/#delete-a-deployment +func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + // DeploymentStatus represents the status of a // particular deployment. type DeploymentStatus struct { diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index fdbfdd3a9f8..587e2d8f887 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -89,6 +89,20 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { } } +func TestRepositoriesService_DeleteDeployment(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/deployments/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + }) + + _, err := client.Repositories.DeleteDeployment(context.Background(), "o", "r", 1) + if err != nil { + t.Errorf("Repositories.DeleteDeployment returned error: %v", err) + } +} + func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { client, mux, _, teardown := setup() defer teardown() From 0b1d8cc10ef6c0797c3e233afe82cd8555badbf4 Mon Sep 17 00:00:00 2001 From: Pablo Perez Schroder Date: Tue, 9 Jun 2020 16:36:20 +0200 Subject: [PATCH 2/4] test for DeleteDeployment failure --- github/repos_deployments_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index 587e2d8f887..da9ef23baa2 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -101,6 +101,14 @@ func TestRepositoriesService_DeleteDeployment(t *testing.T) { if err != nil { t.Errorf("Repositories.DeleteDeployment returned error: %v", err) } + + resp, err := client.Repositories.DeleteDeployment(context.Background(), "o", "r", 2) + if err == nil { + t.Error("Repositories.DeleteDeployment should return an error") + } + if resp.StatusCode != http.StatusNotFound { + t.Error("Repositories.DeleteDeployment should return a 404 status") + } } func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { From 5fcd6b94cef98b6ceaccc8a6a94ebdcf7e349460 Mon Sep 17 00:00:00 2001 From: Ali Kabeel Date: Tue, 10 Sep 2024 19:59:12 +0200 Subject: [PATCH 3/4] Add new CODEOWNERS and create backup of the existing file in master branch --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..0bbcae284a9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @WeTransfer/WeTransfer-CodeOwners \ No newline at end of file From 9cce11477a69d40d477be4d87c99202c0b8f0072 Mon Sep 17 00:00:00 2001 From: Ali Kabeel Date: Wed, 11 Dec 2024 15:09:47 +0000 Subject: [PATCH 4/4] Remove identical CODEOWNERS file from master branch --- .github/CODEOWNERS | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 0bbcae284a9..00000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @WeTransfer/WeTransfer-CodeOwners \ No newline at end of file