@@ -19,30 +19,158 @@ func TestPinActions(t *testing.T) {
19
19
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/peter-evans/close-issue/commits/v1" ,
20
20
httpmock .NewStringResponder (200 , `a700eac5bf2a1c7a8cb6da0c13f93ed96fd53dbe` ))
21
21
22
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/peter-evans/close-issue/git/matching-refs/tags/v1." ,
23
+ httpmock .NewStringResponder (200 ,
24
+ `[
25
+ {
26
+ "ref": "refs/tags/v1.0.3",
27
+ "object": {
28
+ "sha": "a700eac5bf2a1c7a8cb6da0c13f93ed96fd53dbe",
29
+ "type": "commit"
30
+ }
31
+ }
32
+ ]` ))
33
+
22
34
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/checkout/commits/master" ,
23
35
httpmock .NewStringResponder (200 , `61b9e3751b92087fd0b06925ba6dd6314e06f089` ))
24
36
37
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/checkout/git/matching-refs/tags/master." ,
38
+ httpmock .NewStringResponder (200 , `[]` ))
39
+
25
40
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/elgohr/Publish-Docker-Github-Action/commits/master" ,
26
41
httpmock .NewStringResponder (200 , `8217e91c0369a5342a4ef2d612de87492410a666` ))
27
42
43
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/elgohr/Publish-Docker-Github-Action/git/matching-refs/tags/master." ,
44
+ httpmock .NewStringResponder (200 , `[]` ))
45
+
28
46
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/borales/actions-yarn/commits/v2.3.0" ,
29
47
httpmock .NewStringResponder (200 , `4965e1a0f0ae9c422a9a5748ebd1fb5e097d22b9` ))
30
48
49
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/borales/actions-yarn/git/matching-refs/tags/v2.3.0." ,
50
+ httpmock .NewStringResponder (200 , `[]` ))
51
+
31
52
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/checkout/commits/v1" ,
32
53
httpmock .NewStringResponder (200 , `544eadc6bf3d226fd7a7a9f0dc5b5bf7ca0675b9` ))
33
54
55
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/checkout/git/matching-refs/tags/v1." ,
56
+ httpmock .NewStringResponder (200 ,
57
+ `[
58
+ {
59
+ "ref": "refs/tags/v1.0.0",
60
+ "node_id": "MDM6UmVmMTk3ODE0NjI5OnJlZnMvdGFncy92MS4wLjA=",
61
+ "url": "https://api.github.com/repos/actions/checkout/git/refs/tags/v1.0.0",
62
+ "object": {
63
+ "sha": "af513c7a016048ae468971c52ed77d9562c7c819",
64
+ "type": "commit",
65
+ "url": "https://api.github.com/repos/actions/checkout/git/commits/af513c7a016048ae468971c52ed77d9562c7c819"
66
+ }
67
+ },
68
+ {
69
+ "ref": "refs/tags/v1.1.0",
70
+ "node_id": "MDM6UmVmMTk3ODE0NjI5OnJlZnMvdGFncy92MS4xLjA=",
71
+ "url": "https://api.github.com/repos/actions/checkout/git/refs/tags/v1.1.0",
72
+ "object": {
73
+ "sha": "ec3afacf7f605c9fc12c70bc1c9e1708ddb99eca",
74
+ "type": "tag",
75
+ "url": "https://api.github.com/repos/actions/checkout/git/tags/ec3afacf7f605c9fc12c70bc1c9e1708ddb99eca"
76
+ }
77
+ },
78
+ {
79
+ "ref": "refs/tags/v1.2.0",
80
+ "node_id": "MDM6UmVmMTk3ODE0NjI5OnJlZnMvdGFncy92MS4yLjA=",
81
+ "url": "https://api.github.com/repos/actions/checkout/git/refs/tags/v1.2.0",
82
+ "object": {
83
+ "sha": "a2ca40438991a1ab62db1b7cad0fd4e36a2ac254",
84
+ "type": "tag",
85
+ "url": "https://api.github.com/repos/actions/checkout/git/tags/a2ca40438991a1ab62db1b7cad0fd4e36a2ac254"
86
+ }
87
+ }
88
+ ]` ),
89
+ )
90
+
91
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/checkout/commits/v1.2.0" ,
92
+ httpmock .NewStringResponder (200 , `544eadc6bf3d226fd7a7a9f0dc5b5bf7ca0675b9` ))
93
+
34
94
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/setup-node/commits/v1" ,
35
95
httpmock .NewStringResponder (200 , `f1f314fca9dfce2769ece7d933488f076716723e` ))
36
96
97
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/actions/setup-node/git/matching-refs/tags/v1." ,
98
+ httpmock .NewStringResponder (200 ,
99
+ `[
100
+ {
101
+ "ref": "refs/tags/v1.4.6",
102
+ "object": {
103
+ "sha": "f1f314fca9dfce2769ece7d933488f076716723e",
104
+ "type": "commit"
105
+ }
106
+ }
107
+ ]` ))
108
+
37
109
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/JS-DevTools/npm-publish/commits/v1" ,
38
110
httpmock .NewStringResponder (200 , `0f451a94170d1699fd50710966d48fb26194d939` ))
39
111
112
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/JS-DevTools/npm-publish/git/matching-refs/tags/v1." ,
113
+ httpmock .NewStringResponder (200 ,
114
+ `[
115
+ {
116
+ "ref": "refs/tags/v1.4.3",
117
+ "object": {
118
+ "sha": "0f451a94170d1699fd50710966d48fb26194d939",
119
+ "type": "commit"
120
+ }
121
+ }
122
+ ]` ))
123
+
40
124
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/brandedoutcast/publish-nuget/commits/v2" ,
41
125
httpmock .NewStringResponder (200 , `c12b8546b67672ee38ac87bea491ac94a587f7cc` ))
42
126
127
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/brandedoutcast/publish-nuget/git/matching-refs/tags/v2." ,
128
+ httpmock .NewStringResponder (200 ,
129
+ `[
130
+ {
131
+ "ref": "refs/tags/v2.5.3",
132
+ "node_id": "MDM6UmVmMjI4MTk2ODk5OnJlZnMvdGFncy92Mi41LjM=",
133
+ "url": "https://api.github.com/repos/brandedoutcast/publish-nuget/git/refs/tags/v2.5.3",
134
+ "object": {
135
+ "sha": "4637c3bdd3fb4c052235299664c57b14c398cbd0",
136
+ "type": "commit",
137
+ "url": "https://api.github.com/repos/brandedoutcast/publish-nuget/git/commits/4637c3bdd3fb4c052235299664c57b14c398cbd0"
138
+ }
139
+ },
140
+ {
141
+ "ref": "refs/tags/v2.5.4",
142
+ "node_id": "MDM6UmVmMjI4MTk2ODk5OnJlZnMvdGFncy92Mi41LjQ=",
143
+ "url": "https://api.github.com/repos/brandedoutcast/publish-nuget/git/refs/tags/v2.5.4",
144
+ "object": {
145
+ "sha": "108c10b32aa03efa5f71af6a233dc2e8e32845cb",
146
+ "type": "commit",
147
+ "url": "https://api.github.com/repos/brandedoutcast/publish-nuget/git/commits/108c10b32aa03efa5f71af6a233dc2e8e32845cb"
148
+ }
149
+ },
150
+ {
151
+ "ref": "refs/tags/v2.5.5",
152
+ "object": {
153
+ "sha": "c12b8546b67672ee38ac87bea491ac94a587f7cc",
154
+ "type": "commit"
155
+ }
156
+ }
157
+ ]` ))
158
+
43
159
httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/rohith/publish-nuget/commits/v2" ,
44
160
httpmock .NewStringResponder (200 , `c12b8546b67672ee38ac87bea491ac94a587f7cc` ))
45
161
162
+ httpmock .RegisterResponder ("GET" , "https://api.github.com/repos/rohith/publish-nuget/git/matching-refs/tags/v2." ,
163
+ httpmock .NewStringResponder (200 ,
164
+ `[
165
+ {
166
+ "ref": "refs/tags/v2.5.5",
167
+ "object": {
168
+ "sha": "c12b8546b67672ee38ac87bea491ac94a587f7cc",
169
+ "type": "commit"
170
+ }
171
+ }
172
+ ]` ))
173
+
46
174
tests := []struct {
47
175
fileName string
48
176
wantUpdated bool
0 commit comments