|
30 | 30 | )
|
31 | 31 | end
|
32 | 32 |
|
| 33 | + def mock_service_pack_request(nwo) |
| 34 | + stub_request(:get, "https://github.com/#{nwo}.git/info/refs?service=git-upload-pack"). |
| 35 | + to_return( |
| 36 | + status: 200, |
| 37 | + body: fixture("git", "upload_packs", "checkout"), |
| 38 | + headers: { |
| 39 | + "content-type" => "application/x-git-upload-pack-advertisement" |
| 40 | + } |
| 41 | + ) |
| 42 | + end |
| 43 | + |
33 | 44 | describe "parse" do
|
34 | 45 | subject(:dependencies) { parser.parse }
|
35 | 46 |
|
| 47 | + before do |
| 48 | + mock_service_pack_request("actions/checkout") |
| 49 | + mock_service_pack_request("actions/setup-node") |
| 50 | + end |
| 51 | + |
36 | 52 | its(:length) { is_expected.to eq(2) }
|
37 | 53 |
|
38 | 54 | describe "the first dependency" do
|
|
45 | 61 | source: {
|
46 | 62 | type: "git",
|
47 | 63 | url: "https://github.com/actions/checkout",
|
48 |
| - ref: "master", |
| 64 | + ref: "v1", |
49 | 65 | branch: nil
|
50 | 66 | },
|
51 |
| - metadata: { declaration_string: "actions/checkout@master" } |
| 67 | + metadata: { declaration_string: "actions/checkout@v1" } |
52 | 68 | }]
|
53 | 69 | end
|
54 | 70 |
|
55 | 71 | it "has the right details" do
|
56 | 72 | expect(dependency).to be_a(Dependabot::Dependency)
|
57 | 73 | expect(dependency.name).to eq("actions/checkout")
|
58 |
| - expect(dependency.version).to be_nil |
| 74 | + expect(dependency.version).to eq("1") |
59 | 75 | expect(dependency.requirements).to eq(expected_requirements)
|
60 | 76 | end
|
61 | 77 | end
|
62 | 78 |
|
63 | 79 | context "with a path" do
|
64 | 80 | let(:workflow_file_fixture_name) { "workflow_monorepo.yml" }
|
65 | 81 |
|
| 82 | + before do |
| 83 | + mock_service_pack_request("actions/aws") |
| 84 | + end |
| 85 | + |
66 | 86 | its(:length) { is_expected.to eq(2) }
|
67 | 87 |
|
68 | 88 | describe "the last dependency" do
|
|
75 | 95 | source: {
|
76 | 96 | type: "git",
|
77 | 97 | url: "https://github.com/actions/aws",
|
78 |
| - ref: "master", |
| 98 | + ref: "v1.0.0", |
79 | 99 | branch: nil
|
80 | 100 | },
|
81 |
| - metadata: { declaration_string: "actions/aws/ec2@master" } |
| 101 | + metadata: { declaration_string: "actions/aws/ec2@v1.0.0" } |
82 | 102 | }, {
|
83 | 103 | requirement: nil,
|
84 | 104 | groups: [],
|
85 | 105 | file: ".github/workflows/workflow.yml",
|
86 | 106 | source: {
|
87 | 107 | type: "git",
|
88 | 108 | url: "https://github.com/actions/aws",
|
89 |
| - ref: "master", |
| 109 | + ref: "v1.0.0", |
90 | 110 | branch: nil
|
91 | 111 | },
|
92 |
| - metadata: { declaration_string: "actions/aws@master" } |
| 112 | + metadata: { declaration_string: "actions/aws@v1.0.0" } |
93 | 113 | }]
|
94 | 114 | end
|
95 | 115 |
|
96 | 116 | it "has the right details" do
|
97 | 117 | expect(dependency).to be_a(Dependabot::Dependency)
|
98 | 118 | expect(dependency.name).to eq("actions/aws")
|
99 |
| - expect(dependency.version).to be_nil |
| 119 | + expect(dependency.version).to eq("1.0.0") |
100 | 120 | expect(dependency.requirements).to eq(expected_requirements)
|
101 | 121 | end
|
102 | 122 | end
|
|
118 | 138 | branch: nil
|
119 | 139 | },
|
120 | 140 | metadata: { declaration_string: "actions/[email protected]" }
|
121 |
| - }, { |
122 |
| - requirement: nil, |
123 |
| - groups: [], |
124 |
| - file: ".github/workflows/workflow.yml", |
125 |
| - source: { |
126 |
| - type: "git", |
127 |
| - url: "https://github.com/actions/checkout", |
128 |
| - ref: "master", |
129 |
| - branch: nil |
130 |
| - }, |
131 |
| - metadata: { declaration_string: "actions/checkout@master" } |
132 | 141 | }]
|
133 | 142 | end
|
134 | 143 |
|
|
193 | 202 |
|
194 | 203 | its(:length) { is_expected.to eq(4) }
|
195 | 204 |
|
| 205 | + before do |
| 206 | + mock_service_pack_request("docker/setup-qemu-action") |
| 207 | + mock_service_pack_request("docker/setup-buildx-action") |
| 208 | + mock_service_pack_request("docker/login-action") |
| 209 | + end |
| 210 | + |
196 | 211 | context "the first dependency" do
|
197 | 212 | subject(:dependency) { dependencies.first }
|
198 | 213 |
|
|
245 | 260 |
|
246 | 261 | context "with a semver tag pinned to a reusable workflow commit" do
|
247 | 262 | let(:workflow_file_fixture_name) { "workflow_semver_reusable.yml" }
|
248 |
| - let(:service_pack_url) do |
249 |
| - "https://github.com/actions/checkout.git/info/refs" \ |
250 |
| - "?service=git-upload-pack" |
251 |
| - end |
252 |
| - before do |
253 |
| - stub_request(:get, service_pack_url). |
254 |
| - to_return( |
255 |
| - status: 200, |
256 |
| - body: fixture("git", "upload_packs", "checkout"), |
257 |
| - headers: { |
258 |
| - "content-type" => "application/x-git-upload-pack-advertisement" |
259 |
| - } |
260 |
| - ) |
261 |
| - end |
262 | 263 |
|
263 | 264 | its(:length) { is_expected.to eq(1) }
|
264 | 265 |
|
|
0 commit comments