@lvce-editor/eslint-plugin-github-actions 2.11.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +145 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,11 +25,16 @@ const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com
|
|
|
25
25
|
const onProperties = ['push', 'pull_request'];
|
|
26
26
|
const npmCommands = ['run', 'test', 'publish', 'install', 'ci'];
|
|
27
27
|
const shells = ['bash'];
|
|
28
|
+
const permissions$1 = {
|
|
29
|
+
'id-token': ['write'],
|
|
30
|
+
contents: ['write'],
|
|
31
|
+
pages: ['write']
|
|
32
|
+
};
|
|
28
33
|
|
|
29
34
|
const isSupported = (actions, value) => {
|
|
30
35
|
return actions.includes(value);
|
|
31
36
|
};
|
|
32
|
-
const meta$
|
|
37
|
+
const meta$c = {
|
|
33
38
|
type: 'problem',
|
|
34
39
|
docs: {
|
|
35
40
|
description: 'Disallow unsupported action versions'
|
|
@@ -39,7 +44,7 @@ const meta$a = {
|
|
|
39
44
|
},
|
|
40
45
|
fixable: 'code'
|
|
41
46
|
};
|
|
42
|
-
const create$
|
|
47
|
+
const create$c = context => {
|
|
43
48
|
const sourceCode = getSourceCode(context);
|
|
44
49
|
if (!sourceCode.parserServices?.isYAML) {
|
|
45
50
|
return {};
|
|
@@ -70,8 +75,8 @@ const create$a = context => {
|
|
|
70
75
|
|
|
71
76
|
const actionVersions = {
|
|
72
77
|
__proto__: null,
|
|
73
|
-
create: create$
|
|
74
|
-
meta: meta$
|
|
78
|
+
create: create$c,
|
|
79
|
+
meta: meta$c
|
|
75
80
|
};
|
|
76
81
|
|
|
77
82
|
const parseVersion = value => {
|
|
@@ -95,7 +100,7 @@ const isSupportedMacosversion = version => {
|
|
|
95
100
|
const isSupportedWindowsVersion = version => {
|
|
96
101
|
return config.windows.includes(version);
|
|
97
102
|
};
|
|
98
|
-
const meta$
|
|
103
|
+
const meta$b = {
|
|
99
104
|
type: 'problem',
|
|
100
105
|
docs: {
|
|
101
106
|
description: 'Disallow unsupported ci versions'
|
|
@@ -104,7 +109,7 @@ const meta$9 = {
|
|
|
104
109
|
unsupportedCiVersion: 'Unsupported ci version: {{value}}'
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
|
-
const create$
|
|
112
|
+
const create$b = context => {
|
|
108
113
|
const sourceCode = getSourceCode(context);
|
|
109
114
|
if (!sourceCode.parserServices?.isYAML) {
|
|
110
115
|
return {};
|
|
@@ -147,11 +152,11 @@ const create$9 = context => {
|
|
|
147
152
|
|
|
148
153
|
const ciVersions = {
|
|
149
154
|
__proto__: null,
|
|
150
|
-
create: create$
|
|
151
|
-
meta: meta$
|
|
155
|
+
create: create$b,
|
|
156
|
+
meta: meta$b
|
|
152
157
|
};
|
|
153
158
|
|
|
154
|
-
const meta$
|
|
159
|
+
const meta$a = {
|
|
155
160
|
type: 'problem',
|
|
156
161
|
docs: {
|
|
157
162
|
description: 'Disallow unsupported fail fast values'
|
|
@@ -160,7 +165,7 @@ const meta$8 = {
|
|
|
160
165
|
unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
|
|
161
166
|
}
|
|
162
167
|
};
|
|
163
|
-
const create$
|
|
168
|
+
const create$a = context => {
|
|
164
169
|
const sourceCode = getSourceCode(context);
|
|
165
170
|
if (!sourceCode.parserServices?.isYAML) {
|
|
166
171
|
return {};
|
|
@@ -183,11 +188,11 @@ const create$8 = context => {
|
|
|
183
188
|
|
|
184
189
|
const failFast = {
|
|
185
190
|
__proto__: null,
|
|
186
|
-
create: create$
|
|
187
|
-
meta: meta$
|
|
191
|
+
create: create$a,
|
|
192
|
+
meta: meta$a
|
|
188
193
|
};
|
|
189
194
|
|
|
190
|
-
const meta$
|
|
195
|
+
const meta$9 = {
|
|
191
196
|
type: 'problem',
|
|
192
197
|
docs: {
|
|
193
198
|
description: 'Disallow unsupported matrix values'
|
|
@@ -196,7 +201,7 @@ const meta$7 = {
|
|
|
196
201
|
unsupportedMatrix: 'Unsupported matrix value: {{value}}'
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
|
-
const create$
|
|
204
|
+
const create$9 = context => {
|
|
200
205
|
const sourceCode = getSourceCode(context);
|
|
201
206
|
if (!sourceCode.parserServices?.isYAML) {
|
|
202
207
|
return {};
|
|
@@ -218,11 +223,11 @@ const create$7 = context => {
|
|
|
218
223
|
|
|
219
224
|
const matrix = {
|
|
220
225
|
__proto__: null,
|
|
221
|
-
create: create$
|
|
222
|
-
meta: meta$
|
|
226
|
+
create: create$9,
|
|
227
|
+
meta: meta$9
|
|
223
228
|
};
|
|
224
229
|
|
|
225
|
-
const meta$
|
|
230
|
+
const meta$8 = {
|
|
226
231
|
type: 'problem',
|
|
227
232
|
docs: {
|
|
228
233
|
description: 'Disallow unsupported max parallel values'
|
|
@@ -231,7 +236,7 @@ const meta$6 = {
|
|
|
231
236
|
unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
|
|
232
237
|
}
|
|
233
238
|
};
|
|
234
|
-
const create$
|
|
239
|
+
const create$8 = context => {
|
|
235
240
|
const sourceCode = getSourceCode(context);
|
|
236
241
|
if (!sourceCode.parserServices?.isYAML) {
|
|
237
242
|
return {};
|
|
@@ -254,11 +259,11 @@ const create$6 = context => {
|
|
|
254
259
|
|
|
255
260
|
const maxParallel = {
|
|
256
261
|
__proto__: null,
|
|
257
|
-
create: create$
|
|
258
|
-
meta: meta$
|
|
262
|
+
create: create$8,
|
|
263
|
+
meta: meta$8
|
|
259
264
|
};
|
|
260
265
|
|
|
261
|
-
const meta$
|
|
266
|
+
const meta$7 = {
|
|
262
267
|
type: 'problem',
|
|
263
268
|
docs: {
|
|
264
269
|
description: 'Disallow unsupported needs values'
|
|
@@ -267,7 +272,7 @@ const meta$5 = {
|
|
|
267
272
|
unsupportedNeeds: 'Unsupported needs value: {{value}}'
|
|
268
273
|
}
|
|
269
274
|
};
|
|
270
|
-
const create$
|
|
275
|
+
const create$7 = context => {
|
|
271
276
|
const sourceCode = getSourceCode(context);
|
|
272
277
|
if (!sourceCode.parserServices?.isYAML) {
|
|
273
278
|
return {};
|
|
@@ -289,11 +294,11 @@ const create$5 = context => {
|
|
|
289
294
|
|
|
290
295
|
const needs = {
|
|
291
296
|
__proto__: null,
|
|
292
|
-
create: create$
|
|
293
|
-
meta: meta$
|
|
297
|
+
create: create$7,
|
|
298
|
+
meta: meta$7
|
|
294
299
|
};
|
|
295
300
|
|
|
296
|
-
const meta$
|
|
301
|
+
const meta$6 = {
|
|
297
302
|
type: 'problem',
|
|
298
303
|
docs: {
|
|
299
304
|
description: 'Disallow unsupported npm registry values'
|
|
@@ -302,7 +307,7 @@ const meta$4 = {
|
|
|
302
307
|
unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
|
|
303
308
|
}
|
|
304
309
|
};
|
|
305
|
-
const create$
|
|
310
|
+
const create$6 = context => {
|
|
306
311
|
const sourceCode = getSourceCode(context);
|
|
307
312
|
if (!sourceCode.parserServices?.isYAML) {
|
|
308
313
|
return {};
|
|
@@ -327,11 +332,11 @@ const create$4 = context => {
|
|
|
327
332
|
|
|
328
333
|
const npmRegistry = {
|
|
329
334
|
__proto__: null,
|
|
330
|
-
create: create$
|
|
331
|
-
meta: meta$
|
|
335
|
+
create: create$6,
|
|
336
|
+
meta: meta$6
|
|
332
337
|
};
|
|
333
338
|
|
|
334
|
-
const meta$
|
|
339
|
+
const meta$5 = {
|
|
335
340
|
type: 'problem',
|
|
336
341
|
docs: {
|
|
337
342
|
description: 'Disallow unsupported npm commands'
|
|
@@ -348,7 +353,7 @@ const isSupportedNpmCommand = value => {
|
|
|
348
353
|
}
|
|
349
354
|
return false;
|
|
350
355
|
};
|
|
351
|
-
const create$
|
|
356
|
+
const create$5 = context => {
|
|
352
357
|
const sourceCode = getSourceCode(context);
|
|
353
358
|
if (!sourceCode.parserServices?.isYAML) {
|
|
354
359
|
return {};
|
|
@@ -376,11 +381,11 @@ const create$3 = context => {
|
|
|
376
381
|
|
|
377
382
|
const npm = {
|
|
378
383
|
__proto__: null,
|
|
379
|
-
create: create$
|
|
380
|
-
meta: meta$
|
|
384
|
+
create: create$5,
|
|
385
|
+
meta: meta$5
|
|
381
386
|
};
|
|
382
387
|
|
|
383
|
-
const meta$
|
|
388
|
+
const meta$4 = {
|
|
384
389
|
type: 'problem',
|
|
385
390
|
docs: {
|
|
386
391
|
description: 'Disallow unsupported on values'
|
|
@@ -389,7 +394,7 @@ const meta$2 = {
|
|
|
389
394
|
unsupportedOn: 'Unsupported on value: {{value}}'
|
|
390
395
|
}
|
|
391
396
|
};
|
|
392
|
-
const create$
|
|
397
|
+
const create$4 = context => {
|
|
393
398
|
const sourceCode = getSourceCode(context);
|
|
394
399
|
if (!sourceCode.parserServices?.isYAML) {
|
|
395
400
|
return {};
|
|
@@ -416,11 +421,66 @@ const create$2 = context => {
|
|
|
416
421
|
|
|
417
422
|
const on = {
|
|
418
423
|
__proto__: null,
|
|
419
|
-
create: create$
|
|
420
|
-
meta: meta$
|
|
424
|
+
create: create$4,
|
|
425
|
+
meta: meta$4
|
|
421
426
|
};
|
|
422
427
|
|
|
423
|
-
const meta$
|
|
428
|
+
const meta$3 = {
|
|
429
|
+
type: 'problem',
|
|
430
|
+
docs: {
|
|
431
|
+
description: 'Disallow unsupported permission values'
|
|
432
|
+
},
|
|
433
|
+
messages: {
|
|
434
|
+
unsupportedPermission: 'Unsupported permission value: {{value}}'
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const create$3 = context => {
|
|
438
|
+
const sourceCode = getSourceCode(context);
|
|
439
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
440
|
+
return {};
|
|
441
|
+
}
|
|
442
|
+
return {
|
|
443
|
+
YAMLPair(node) {
|
|
444
|
+
if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'permissions' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLMapping') {
|
|
445
|
+
for (const pair of node.value.pairs) {
|
|
446
|
+
if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string') {
|
|
447
|
+
const supportedKey = Object.hasOwn(permissions$1, pair.key.value);
|
|
448
|
+
if (!supportedKey) {
|
|
449
|
+
context.report({
|
|
450
|
+
node: pair.key,
|
|
451
|
+
messageId: 'unsupportedPermission',
|
|
452
|
+
data: {
|
|
453
|
+
value: pair
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
} else {
|
|
457
|
+
if (pair.value && pair.value.type === 'YAMLScalar' && typeof pair.value.value === 'string') {
|
|
458
|
+
const items = permissions$1[pair.key.value] || [];
|
|
459
|
+
if (!items.includes(pair.value.value)) {
|
|
460
|
+
context.report({
|
|
461
|
+
node,
|
|
462
|
+
messageId: 'unsupportedPermission',
|
|
463
|
+
data: {
|
|
464
|
+
value: pair.value
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const permissions = {
|
|
478
|
+
__proto__: null,
|
|
479
|
+
create: create$3,
|
|
480
|
+
meta: meta$3
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const meta$2 = {
|
|
424
484
|
type: 'problem',
|
|
425
485
|
docs: {
|
|
426
486
|
description: 'Disallow unsupported shell values'
|
|
@@ -429,7 +489,7 @@ const meta$1 = {
|
|
|
429
489
|
unsupportedShell: 'Unsupported shell value: {{value}}'
|
|
430
490
|
}
|
|
431
491
|
};
|
|
432
|
-
const create$
|
|
492
|
+
const create$2 = context => {
|
|
433
493
|
const sourceCode = getSourceCode(context);
|
|
434
494
|
if (!sourceCode.parserServices?.isYAML) {
|
|
435
495
|
return {};
|
|
@@ -454,11 +514,11 @@ const create$1 = context => {
|
|
|
454
514
|
|
|
455
515
|
const shell = {
|
|
456
516
|
__proto__: null,
|
|
457
|
-
create: create$
|
|
458
|
-
meta: meta$
|
|
517
|
+
create: create$2,
|
|
518
|
+
meta: meta$2
|
|
459
519
|
};
|
|
460
520
|
|
|
461
|
-
const meta = {
|
|
521
|
+
const meta$1 = {
|
|
462
522
|
type: 'problem',
|
|
463
523
|
docs: {
|
|
464
524
|
description: 'Disallow unsupported timeout minute values'
|
|
@@ -467,7 +527,7 @@ const meta = {
|
|
|
467
527
|
unsupportedTimeoutMinutes: 'Unsupported timeout minutes value: {{value}}'
|
|
468
528
|
}
|
|
469
529
|
};
|
|
470
|
-
const create = context => {
|
|
530
|
+
const create$1 = context => {
|
|
471
531
|
const sourceCode = getSourceCode(context);
|
|
472
532
|
if (!sourceCode.parserServices?.isYAML) {
|
|
473
533
|
return {};
|
|
@@ -489,6 +549,44 @@ const create = context => {
|
|
|
489
549
|
};
|
|
490
550
|
|
|
491
551
|
const timeoutMinutes = {
|
|
552
|
+
__proto__: null,
|
|
553
|
+
create: create$1,
|
|
554
|
+
meta: meta$1
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const meta = {
|
|
558
|
+
type: 'problem',
|
|
559
|
+
docs: {
|
|
560
|
+
description: 'Disallow unsupported node version file values'
|
|
561
|
+
},
|
|
562
|
+
messages: {
|
|
563
|
+
unsupportedNodeVersionFile: 'Unsupported node version file value: {{value}}'
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
const create = context => {
|
|
567
|
+
const sourceCode = getSourceCode(context);
|
|
568
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
569
|
+
return {};
|
|
570
|
+
}
|
|
571
|
+
return {
|
|
572
|
+
YAMLPair(node) {
|
|
573
|
+
if (node && node.type === 'YAMLPair' && node.key && typeof node.key === 'object' && 'type' in node.key && node.key.type === 'YAMLScalar' && typeof node.key.value === 'string' && node.key.value === 'node-version-file' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
574
|
+
const nodeValue = node.value.value;
|
|
575
|
+
if (typeof nodeValue !== 'string' || nodeValue !== '.nvmrc') {
|
|
576
|
+
context.report({
|
|
577
|
+
node,
|
|
578
|
+
messageId: 'unsupportedNodeVersionFile',
|
|
579
|
+
data: {
|
|
580
|
+
value: nodeValue
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
const nodeVersionFile = {
|
|
492
590
|
__proto__: null,
|
|
493
591
|
create,
|
|
494
592
|
meta
|
|
@@ -504,12 +602,14 @@ const plugin = {
|
|
|
504
602
|
'ci-versions': ciVersions,
|
|
505
603
|
'fail-fast': failFast,
|
|
506
604
|
'max-parallel': maxParallel,
|
|
605
|
+
'node-version-file': nodeVersionFile,
|
|
507
606
|
'npm-registry': npmRegistry,
|
|
508
607
|
'timeout-minutes': timeoutMinutes,
|
|
509
608
|
matrix: matrix,
|
|
510
609
|
needs: needs,
|
|
511
610
|
npm: npm,
|
|
512
611
|
on: on,
|
|
612
|
+
permissions,
|
|
513
613
|
shell
|
|
514
614
|
}
|
|
515
615
|
};
|
|
@@ -527,10 +627,12 @@ const recommended = [{
|
|
|
527
627
|
'github-actions/fail-fast': 'error',
|
|
528
628
|
'github-actions/matrix': 'off',
|
|
529
629
|
'github-actions/max-parallel': 'error',
|
|
630
|
+
'github-actions/needs': 'error',
|
|
631
|
+
'github-actions/node-version-file': 'error',
|
|
530
632
|
'github-actions/npm-registry': 'error',
|
|
531
633
|
'github-actions/npm': 'error',
|
|
532
|
-
'github-actions/needs': 'error',
|
|
533
634
|
'github-actions/on': 'error',
|
|
635
|
+
'github-actions/permissions': 'error',
|
|
534
636
|
'github-actions/shell': 'error',
|
|
535
637
|
'github-actions/timeout-minutes': 'error'
|
|
536
638
|
}
|