@@ -90,132 +90,240 @@ describe("blockAllContributors", () => {
90
90
` ) ;
91
91
} ) ;
92
92
93
- it ( "includes contributors when provided " , ( ) => {
93
+ it ( "runs add including existing owner contributions when they exist " , ( ) => {
94
94
const creation = testBlock ( blockAllContributors , {
95
95
options : {
96
96
...optionsBase ,
97
97
contributors : [
98
98
{
99
99
avatar_url : "https://avatars.githubusercontent.com/u/3335181?v=4" ,
100
- contributions : [
101
- "bug" ,
102
- "code" ,
103
- "design" ,
104
- "doc" ,
105
- "ideas" ,
106
- "infra" ,
107
- "maintenance" ,
108
- "review" ,
109
- "test" ,
110
- "tool" ,
111
- ] ,
100
+ contributions : [ "bug" , "code" , "design" , "doc" , "test" , "tool" ] ,
112
101
login : "JoshuaKGoldberg" ,
113
102
name : "Josh Goldberg" ,
114
103
profile : "http://www.joshuakgoldberg.com" ,
115
104
} ,
116
105
] ,
106
+ owner : "JoshuaKGoldberg" ,
117
107
} ,
118
108
} ) ;
119
109
120
110
expect ( creation ) . toMatchInlineSnapshot ( `
121
- {
122
- "addons": [
123
- {
124
- "addons": {
125
- "ignores": [
126
- "/.all-contributorsrc",
127
- ],
128
- },
129
- "block": [Function],
130
- },
131
- {
132
- "addons": {
133
- "badges": [
134
- {
135
- "alt": "👪 All Contributors: 1",
136
- "comments": {
137
- "after": "
138
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
139
- <!-- prettier-ignore-end -->",
140
- "before": "<!-- prettier-ignore-start -->
141
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
142
- ",
143
- },
144
- "href": "#contributors",
145
- "src": "https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-1-21bb42.svg",
146
- },
147
- ],
148
- "sections": [
149
- "## Contributors
150
-
151
- <!-- spellchecker: disable -->
152
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
153
- <!-- prettier-ignore-start -->
154
- <!-- markdownlint-disable -->
155
- <table>
156
- <tbody>
157
- <tr>
158
- <td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#design-JoshuaKGoldberg" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#ideas-JoshuaKGoldberg" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/pulls?q=is%3Apr+reviewed-by%3AJoshuaKGoldberg" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a></td>
159
- </tr>
160
- </tbody>
161
- </table>
162
-
163
- <!-- markdownlint-restore -->
164
- <!-- prettier-ignore-end -->
165
-
166
- <!-- ALL-CONTRIBUTORS-LIST:END -->
167
- <!-- spellchecker: enable -->",
168
- ],
169
- },
170
- "block": [Function],
171
- },
172
- {
173
- "addons": {
174
- "secrets": [
175
- {
176
- "description": "a GitHub PAT with repo and workflow permissions",
177
- "name": "ACCESS_TOKEN",
178
- },
179
- ],
180
- },
181
- "block": [Function],
182
- },
183
- ],
184
- "files": {
185
- ".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[{"avatar_url":"https://avatars.githubusercontent.com/u/3335181?v=4","contributions":["bug","code","design","doc","ideas","infra","maintenance","review","test","tool"],"login":"JoshuaKGoldberg","name":"Josh Goldberg","profile":"http://www.joshuakgoldberg.com"}],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"test-owner"}",
186
- ".github": {
187
- "workflows": {
188
- "contributors.yml": "jobs:
189
- contributors:
190
- runs-on: ubuntu-latest
191
- steps:
192
- - uses: actions/checkout@v4
193
- with:
194
- fetch-depth: 0
195
- - uses: ./.github/actions/prepare
196
- - env:
197
- GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
198
- uses: JoshuaKGoldberg/[email protected]
199
-
200
- name: Contributors
201
-
202
- on:
203
- push:
204
- branches:
205
- - main
206
- ",
207
- },
208
- },
209
- },
210
- "scripts": [
211
- {
212
- "commands": [
213
- "pnpx all-contributors-cli add test-owner code,content,doc,ideas,infra,maintenance,projectManagement,tool",
214
- ],
215
- "phase": 3,
216
- },
217
- ],
218
- }
219
- ` ) ;
111
+ {
112
+ "addons": [
113
+ {
114
+ "addons": {
115
+ "ignores": [
116
+ "/.all-contributorsrc",
117
+ ],
118
+ },
119
+ "block": [Function],
120
+ },
121
+ {
122
+ "addons": {
123
+ "badges": [
124
+ {
125
+ "alt": "👪 All Contributors: 1",
126
+ "comments": {
127
+ "after": "
128
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
129
+ <!-- prettier-ignore-end -->",
130
+ "before": "<!-- prettier-ignore-start -->
131
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
132
+ ",
133
+ },
134
+ "href": "#contributors",
135
+ "src": "https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-1-21bb42.svg",
136
+ },
137
+ ],
138
+ "sections": [
139
+ "## Contributors
140
+
141
+ <!-- spellchecker: disable -->
142
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
143
+ <!-- prettier-ignore-start -->
144
+ <!-- markdownlint-disable -->
145
+ <table>
146
+ <tbody>
147
+ <tr>
148
+ <td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#design-JoshuaKGoldberg" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a></td>
149
+ </tr>
150
+ </tbody>
151
+ </table>
152
+
153
+ <!-- markdownlint-restore -->
154
+ <!-- prettier-ignore-end -->
155
+
156
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
157
+ <!-- spellchecker: enable -->",
158
+ ],
159
+ },
160
+ "block": [Function],
161
+ },
162
+ {
163
+ "addons": {
164
+ "secrets": [
165
+ {
166
+ "description": "a GitHub PAT with repo and workflow permissions",
167
+ "name": "ACCESS_TOKEN",
168
+ },
169
+ ],
170
+ },
171
+ "block": [Function],
172
+ },
173
+ ],
174
+ "files": {
175
+ ".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[{"avatar_url":"https://avatars.githubusercontent.com/u/3335181?v=4","contributions":["bug","code","design","doc","test","tool"],"login":"JoshuaKGoldberg","name":"Josh Goldberg","profile":"http://www.joshuakgoldberg.com"}],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"JoshuaKGoldberg"}",
176
+ ".github": {
177
+ "workflows": {
178
+ "contributors.yml": "jobs:
179
+ contributors:
180
+ runs-on: ubuntu-latest
181
+ steps:
182
+ - uses: actions/checkout@v4
183
+ with:
184
+ fetch-depth: 0
185
+ - uses: ./.github/actions/prepare
186
+ - env:
187
+ GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
188
+ uses: JoshuaKGoldberg/[email protected]
189
+
190
+ name: Contributors
191
+
192
+ on:
193
+ push:
194
+ branches:
195
+ - main
196
+ ",
197
+ },
198
+ },
199
+ },
200
+ "scripts": [
201
+ {
202
+ "commands": [
203
+ "pnpx all-contributors-cli add JoshuaKGoldberg bug,code,design,doc,test,tool,content,ideas,infra,maintenance,projectManagement",
204
+ ],
205
+ "phase": 3,
206
+ },
207
+ ],
208
+ }
209
+ ` ) ;
210
+ } ) ;
211
+
212
+ it ( "adds full owner contributions when no existing contributor is the owner" , ( ) => {
213
+ const creation = testBlock ( blockAllContributors , {
214
+ options : {
215
+ ...optionsBase ,
216
+ contributors : [
217
+ {
218
+ avatar_url : "https://avatars.githubusercontent.com/u/3335181?v=4" ,
219
+ contributions : [ "bug" , "code" , "design" , "doc" , "test" , "tool" ] ,
220
+ login : "other" ,
221
+ name : "Other" ,
222
+ profile : "http://www.example.com" ,
223
+ } ,
224
+ ] ,
225
+ } ,
226
+ } ) ;
227
+
228
+ expect ( creation ) . toMatchInlineSnapshot ( `
229
+ {
230
+ "addons": [
231
+ {
232
+ "addons": {
233
+ "ignores": [
234
+ "/.all-contributorsrc",
235
+ ],
236
+ },
237
+ "block": [Function],
238
+ },
239
+ {
240
+ "addons": {
241
+ "badges": [
242
+ {
243
+ "alt": "👪 All Contributors: 1",
244
+ "comments": {
245
+ "after": "
246
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
247
+ <!-- prettier-ignore-end -->",
248
+ "before": "<!-- prettier-ignore-start -->
249
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
250
+ ",
251
+ },
252
+ "href": "#contributors",
253
+ "src": "https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-1-21bb42.svg",
254
+ },
255
+ ],
256
+ "sections": [
257
+ "## Contributors
258
+
259
+ <!-- spellchecker: disable -->
260
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
261
+ <!-- prettier-ignore-start -->
262
+ <!-- markdownlint-disable -->
263
+ <table>
264
+ <tbody>
265
+ <tr>
266
+ <td align="center" valign="top" width="14.28%"><a href="http://www.example.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Other"/><br /><sub><b>Other</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Aother" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=other" title="Code">💻</a> <a href="#design-other" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=other" title="Documentation">📖</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=other" title="Tests">⚠️</a> <a href="#tool-other" title="Tools">🔧</a></td>
267
+ </tr>
268
+ </tbody>
269
+ </table>
270
+
271
+ <!-- markdownlint-restore -->
272
+ <!-- prettier-ignore-end -->
273
+
274
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
275
+ <!-- spellchecker: enable -->",
276
+ ],
277
+ },
278
+ "block": [Function],
279
+ },
280
+ {
281
+ "addons": {
282
+ "secrets": [
283
+ {
284
+ "description": "a GitHub PAT with repo and workflow permissions",
285
+ "name": "ACCESS_TOKEN",
286
+ },
287
+ ],
288
+ },
289
+ "block": [Function],
290
+ },
291
+ ],
292
+ "files": {
293
+ ".all-contributorsrc": "{"badgeTemplate":"\\t<a href=\\"#contributors\\" target=\\"_blank\\"><img alt=\\"👪 All Contributors: <%= contributors.length %>\\" src=\\"https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-<%= contributors.length %>-21bb42.svg\\" /></a>","contributors":[{"avatar_url":"https://avatars.githubusercontent.com/u/3335181?v=4","contributions":["bug","code","design","doc","test","tool"],"login":"other","name":"Other","profile":"http://www.example.com"}],"contributorsSortAlphabetically":true,"projectName":"test-repository","projectOwner":"test-owner"}",
294
+ ".github": {
295
+ "workflows": {
296
+ "contributors.yml": "jobs:
297
+ contributors:
298
+ runs-on: ubuntu-latest
299
+ steps:
300
+ - uses: actions/checkout@v4
301
+ with:
302
+ fetch-depth: 0
303
+ - uses: ./.github/actions/prepare
304
+ - env:
305
+ GITHUB_TOKEN: \${{ secrets.ACCESS_TOKEN }}
306
+ uses: JoshuaKGoldberg/[email protected]
307
+
308
+ name: Contributors
309
+
310
+ on:
311
+ push:
312
+ branches:
313
+ - main
314
+ ",
315
+ },
316
+ },
317
+ },
318
+ "scripts": [
319
+ {
320
+ "commands": [
321
+ "pnpx all-contributors-cli add test-owner code,content,doc,ideas,infra,maintenance,projectManagement,tool",
322
+ ],
323
+ "phase": 3,
324
+ },
325
+ ],
326
+ }
327
+ ` ) ;
220
328
} ) ;
221
329
} ) ;
0 commit comments