forked from joakimk/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
not 100% on this, perhaps these should show in the projects but not on the dashboard
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,33 @@ | |
|
||
let(:attributes) { | ||
{ | ||
repository: { ssh_url: "[email protected]:user/foo.git" }, | ||
repository: { ssh_url: "[email protected]:user/foo.git", default_branch: "main" }, | ||
workflow_job: { | ||
name: "foo_tests", | ||
head_sha: "440f78f6de0c71e073707d9435db89f8e5390a59", | ||
status: "success", | ||
conclusion: "success", | ||
html_url: "http://example.com/status-for-job/foo_tests", | ||
head_branch: "main" | ||
}, | ||
} | ||
} | ||
|
||
it "adds or updates build status" do | ||
it "adds or updates build status for the default branch" do | ||
post "/api/github_actions_webhook", headers: { "X-Hub-Signature-256" => "sha256=secret" }, params: attributes | ||
|
||
expect(response).to be_successful | ||
expect(Build.last.status).to eq("successful") | ||
end | ||
|
||
it "ignores requests for non-default branches" do | ||
attributes[:workflow_job][:head_branch] = "feature-branch" | ||
post "/api/github_actions_webhook", headers: { "X-Hub-Signature-256" => "sha256=secret" }, params: attributes | ||
|
||
expect(response).to be_successful | ||
expect(Build.all).to be_empty | ||
end | ||
|
||
it "ignores requests without a workflow job" do | ||
post "/api/github_actions_webhook", headers: { "X-Hub-Signature-256" => "sha256=secret" }, params: { zen: "something else" } | ||
|
||
|