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