diff --git a/lib/github_service/commands/cross_repo_test.rb b/lib/github_service/commands/cross_repo_test.rb index 025902f6..05c5f90b 100644 --- a/lib/github_service/commands/cross_repo_test.rb +++ b/lib/github_service/commands/cross_repo_test.rb @@ -274,15 +274,15 @@ def update_github_workflow_yaml_content raw_yaml = rugged_repo.blob_at(branch_ref.target.oid, ".github/workflows/ci.yaml").content content = YAML.safe_load(raw_yaml) - content["jobs"] = test_repos.each_with_object({}) do |test_repo, result| - result[test_repo] = { + content["jobs"] = { + "cross-repo" => { "uses" => "ManageIQ/manageiq-cross_repo/.github/workflows/manageiq_cross_repo.yaml@master", "with" => { - "test-repo" => test_repo, - "repos" => repos.join(",") + "test-repos" => test_repos.inspect, + "repos" => repos.join(",") } } - end + } entry = {} entry[:path] = ".github/workflows/ci.yaml" diff --git a/spec/lib/github_service/commands/cross_repo_test_spec.rb b/spec/lib/github_service/commands/cross_repo_test_spec.rb index 087dc8bf..56c16cfb 100644 --- a/spec/lib/github_service/commands/cross_repo_test_spec.rb +++ b/spec/lib/github_service/commands/cross_repo_test_spec.rb @@ -42,7 +42,7 @@ manageiq: uses: agrare/manageiq-cross_repo/.github/workflows/manageiq_cross_repo.yaml@github_actions with: - test-repo: ManageIQ/manageiq@master + test-repos: '["ManageIQ/manageiq@master"]' repos: ManageIQ/manageiq@master YAML @@ -386,14 +386,8 @@ def assert_execute(valid: true) github_workflow_yml_content = repo.blob_at(branch.target.oid, ".github/workflows/ci.yaml").content content = YAML.safe_load(github_workflow_yml_content) - expect(content["jobs"].count).to eq(2) - expect(content["jobs"].keys).to match_array(["foo", "bar"]) - - expect(content["jobs"]["foo"]["with"]["test-repo"]).to eq("foo") - expect(content["jobs"]["bar"]["with"]["test-repo"]).to eq("bar") - - expect(content["jobs"]["foo"]["with"]["repos"]).to eq("repo1,repo2") - expect(content["jobs"]["bar"]["with"]["repos"]).to eq("repo1,repo2") + expect(content["jobs"]["cross-repo"]["with"]["test-repos"]).to eq('["foo", "bar"]') + expect(content["jobs"]["cross-repo"]["with"]["repos"]).to eq("repo1,repo2") end it "commits the changes" do @@ -414,8 +408,7 @@ def assert_execute(valid: true) MSG expect(commit_content).to include "repos: repo1,repo2" - expect(commit_content).to include "test-repo: foo" - expect(commit_content).to include "test-repo: bar" + expect(commit_content).to include "test-repos: '[\"foo\", \"bar\"]'" end it "pushes the changes" do @@ -436,8 +429,7 @@ def assert_execute(valid: true) MSG expect(commit_content).to include "repos: repo1,repo2" - expect(commit_content).to include "test-repo: foo" - expect(commit_content).to include "test-repo: bar" + expect(commit_content).to include "test-repos: '[\"foo\", \"bar\"]'" end end