@lvce-editor/eslint-plugin-github-actions 2.17.0 → 2.19.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 +263 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as parserYAML from 'yaml-eslint-parser';
|
|
2
2
|
import { getSourceCode } from 'eslint-compat-utils';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import { resolve, relative } from 'path';
|
|
3
5
|
|
|
4
6
|
const config = {
|
|
5
7
|
ubuntu: ['ubuntu-24.04'],
|
|
@@ -12,20 +14,21 @@ const platforms = {
|
|
|
12
14
|
macos: 'macos'
|
|
13
15
|
};
|
|
14
16
|
const actions = {
|
|
15
|
-
'actions/checkout': ['actions/checkout@v5'],
|
|
16
|
-
'actions/setup-node': ['actions/setup-node@v6'],
|
|
17
17
|
'actions/cache': ['actions/cache@v4'],
|
|
18
|
-
'actions/
|
|
18
|
+
'actions/checkout': ['actions/checkout@v5'],
|
|
19
|
+
'actions/create-release': ['actions/create-release@v1'],
|
|
19
20
|
'actions/deploy-pages': ['actions/deploy-pages@v4'],
|
|
20
21
|
'actions/download-artifact': ['actions/download-artifact@v6'],
|
|
22
|
+
'actions/setup-node': ['actions/setup-node@v6'],
|
|
23
|
+
'actions/setup-python': ['actions/setup-python@v5'],
|
|
21
24
|
'actions/upload-artifact': ['actions/upload-artifact@v5'],
|
|
22
|
-
'actions/
|
|
23
|
-
'actions/setup-python': ['actions/setup-python@v5']
|
|
25
|
+
'actions/upload-pages-artifact': ['actions/upload-pages-artifact@v4']
|
|
24
26
|
};
|
|
25
27
|
const npmRegistries = ['https://registry.npmjs.org', 'https://npm.pkg.github.com'];
|
|
26
28
|
const onProperties = ['push', 'pull_request'];
|
|
27
29
|
const npmCommands = ['run', 'test', 'publish', 'install', 'ci'];
|
|
28
30
|
const shells = ['bash'];
|
|
31
|
+
const pythonVersions = ['3.13', '3.14', '3.15'];
|
|
29
32
|
const permissions$1 = {
|
|
30
33
|
'id-token': ['write'],
|
|
31
34
|
contents: ['write'],
|
|
@@ -35,7 +38,7 @@ const permissions$1 = {
|
|
|
35
38
|
const isSupported = (actions, value) => {
|
|
36
39
|
return actions.includes(value);
|
|
37
40
|
};
|
|
38
|
-
const meta$
|
|
41
|
+
const meta$f = {
|
|
39
42
|
type: 'problem',
|
|
40
43
|
docs: {
|
|
41
44
|
description: 'Disallow unsupported action versions'
|
|
@@ -45,7 +48,7 @@ const meta$c = {
|
|
|
45
48
|
},
|
|
46
49
|
fixable: 'code'
|
|
47
50
|
};
|
|
48
|
-
const create$
|
|
51
|
+
const create$f = context => {
|
|
49
52
|
const sourceCode = getSourceCode(context);
|
|
50
53
|
if (!sourceCode.parserServices?.isYAML) {
|
|
51
54
|
return {};
|
|
@@ -76,8 +79,8 @@ const create$c = context => {
|
|
|
76
79
|
|
|
77
80
|
const actionVersions = {
|
|
78
81
|
__proto__: null,
|
|
79
|
-
create: create$
|
|
80
|
-
meta: meta$
|
|
82
|
+
create: create$f,
|
|
83
|
+
meta: meta$f
|
|
81
84
|
};
|
|
82
85
|
|
|
83
86
|
const parseVersion = value => {
|
|
@@ -101,7 +104,7 @@ const isSupportedMacosversion = version => {
|
|
|
101
104
|
const isSupportedWindowsVersion = version => {
|
|
102
105
|
return config.windows.includes(version);
|
|
103
106
|
};
|
|
104
|
-
const meta$
|
|
107
|
+
const meta$e = {
|
|
105
108
|
type: 'problem',
|
|
106
109
|
docs: {
|
|
107
110
|
description: 'Disallow unsupported ci versions'
|
|
@@ -110,7 +113,7 @@ const meta$b = {
|
|
|
110
113
|
unsupportedCiVersion: 'Unsupported ci version: {{value}}'
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
|
-
const create$
|
|
116
|
+
const create$e = context => {
|
|
114
117
|
const sourceCode = getSourceCode(context);
|
|
115
118
|
if (!sourceCode.parserServices?.isYAML) {
|
|
116
119
|
return {};
|
|
@@ -153,11 +156,11 @@ const create$b = context => {
|
|
|
153
156
|
|
|
154
157
|
const ciVersions = {
|
|
155
158
|
__proto__: null,
|
|
156
|
-
create: create$
|
|
157
|
-
meta: meta$
|
|
159
|
+
create: create$e,
|
|
160
|
+
meta: meta$e
|
|
158
161
|
};
|
|
159
162
|
|
|
160
|
-
const meta$
|
|
163
|
+
const meta$d = {
|
|
161
164
|
type: 'problem',
|
|
162
165
|
docs: {
|
|
163
166
|
description: 'Disallow unsupported fail fast values'
|
|
@@ -166,7 +169,7 @@ const meta$a = {
|
|
|
166
169
|
unsupportedFailFast: 'Unsupported fail fast value: {{value}}'
|
|
167
170
|
}
|
|
168
171
|
};
|
|
169
|
-
const create$
|
|
172
|
+
const create$d = context => {
|
|
170
173
|
const sourceCode = getSourceCode(context);
|
|
171
174
|
if (!sourceCode.parserServices?.isYAML) {
|
|
172
175
|
return {};
|
|
@@ -189,11 +192,11 @@ const create$a = context => {
|
|
|
189
192
|
|
|
190
193
|
const failFast = {
|
|
191
194
|
__proto__: null,
|
|
192
|
-
create: create$
|
|
193
|
-
meta: meta$
|
|
195
|
+
create: create$d,
|
|
196
|
+
meta: meta$d
|
|
194
197
|
};
|
|
195
198
|
|
|
196
|
-
const meta$
|
|
199
|
+
const meta$c = {
|
|
197
200
|
type: 'problem',
|
|
198
201
|
docs: {
|
|
199
202
|
description: 'Disallow unsupported matrix values'
|
|
@@ -202,7 +205,7 @@ const meta$9 = {
|
|
|
202
205
|
unsupportedMatrix: 'Unsupported matrix value: {{value}}'
|
|
203
206
|
}
|
|
204
207
|
};
|
|
205
|
-
const create$
|
|
208
|
+
const create$c = context => {
|
|
206
209
|
const sourceCode = getSourceCode(context);
|
|
207
210
|
if (!sourceCode.parserServices?.isYAML) {
|
|
208
211
|
return {};
|
|
@@ -224,11 +227,11 @@ const create$9 = context => {
|
|
|
224
227
|
|
|
225
228
|
const matrix = {
|
|
226
229
|
__proto__: null,
|
|
227
|
-
create: create$
|
|
228
|
-
meta: meta$
|
|
230
|
+
create: create$c,
|
|
231
|
+
meta: meta$c
|
|
229
232
|
};
|
|
230
233
|
|
|
231
|
-
const meta$
|
|
234
|
+
const meta$b = {
|
|
232
235
|
type: 'problem',
|
|
233
236
|
docs: {
|
|
234
237
|
description: 'Disallow unsupported max parallel values'
|
|
@@ -237,7 +240,7 @@ const meta$8 = {
|
|
|
237
240
|
unsupportedMaxParallel: 'Unsupported max parallel value: {{value}}'
|
|
238
241
|
}
|
|
239
242
|
};
|
|
240
|
-
const create$
|
|
243
|
+
const create$b = context => {
|
|
241
244
|
const sourceCode = getSourceCode(context);
|
|
242
245
|
if (!sourceCode.parserServices?.isYAML) {
|
|
243
246
|
return {};
|
|
@@ -260,11 +263,11 @@ const create$8 = context => {
|
|
|
260
263
|
|
|
261
264
|
const maxParallel = {
|
|
262
265
|
__proto__: null,
|
|
263
|
-
create: create$
|
|
264
|
-
meta: meta$
|
|
266
|
+
create: create$b,
|
|
267
|
+
meta: meta$b
|
|
265
268
|
};
|
|
266
269
|
|
|
267
|
-
const meta$
|
|
270
|
+
const meta$a = {
|
|
268
271
|
type: 'problem',
|
|
269
272
|
docs: {
|
|
270
273
|
description: 'Disallow unsupported needs values'
|
|
@@ -273,19 +276,78 @@ const meta$7 = {
|
|
|
273
276
|
unsupportedNeeds: 'Unsupported needs value: {{value}}'
|
|
274
277
|
}
|
|
275
278
|
};
|
|
276
|
-
const
|
|
279
|
+
const stringifyValue = node => {
|
|
280
|
+
if (!node) {
|
|
281
|
+
return '';
|
|
282
|
+
}
|
|
283
|
+
if (node.type === 'YAMLScalar') {
|
|
284
|
+
return `${node.value}`;
|
|
285
|
+
}
|
|
286
|
+
return `${node.type}`;
|
|
287
|
+
};
|
|
288
|
+
const getValidNeeds = node => {
|
|
289
|
+
const greatGrandParent = node.parent.parent.parent;
|
|
290
|
+
const validNeeds = [];
|
|
291
|
+
if (greatGrandParent.type === 'YAMLMapping') {
|
|
292
|
+
const pairs = greatGrandParent.pairs;
|
|
293
|
+
for (const pair of pairs) {
|
|
294
|
+
if (pair.key && pair.key.type === 'YAMLScalar' && typeof pair.key.value === 'string') {
|
|
295
|
+
validNeeds.push(pair.key.value);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return validNeeds;
|
|
300
|
+
};
|
|
301
|
+
const create$a = context => {
|
|
277
302
|
const sourceCode = getSourceCode(context);
|
|
278
303
|
if (!sourceCode.parserServices?.isYAML) {
|
|
279
304
|
return {};
|
|
280
305
|
}
|
|
281
306
|
return {
|
|
282
307
|
YAMLPair(node) {
|
|
283
|
-
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 === 'needs' && node.value && typeof node.value === 'object' && 'type' in node.value
|
|
308
|
+
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 === 'needs' && node.value && typeof node.value === 'object' && 'type' in node.value) {
|
|
309
|
+
const validNeeds = getValidNeeds(node);
|
|
310
|
+
if (node.value.type === 'YAMLScalar' && typeof node.value.value === 'string') {
|
|
311
|
+
if (!validNeeds.includes(node.value.value)) {
|
|
312
|
+
context.report({
|
|
313
|
+
node,
|
|
314
|
+
messageId: 'unsupportedNeeds',
|
|
315
|
+
data: {
|
|
316
|
+
value: stringifyValue(node.value)
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (node.value.type === 'YAMLSequence') {
|
|
323
|
+
for (const item of node.value.entries) {
|
|
324
|
+
if (!item || item.type !== 'YAMLScalar' || typeof item.value !== 'string') {
|
|
325
|
+
context.report({
|
|
326
|
+
node,
|
|
327
|
+
messageId: 'unsupportedNeeds',
|
|
328
|
+
data: {
|
|
329
|
+
value: stringifyValue(item)
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
if (!validNeeds.includes(item.value)) {
|
|
335
|
+
context.report({
|
|
336
|
+
node,
|
|
337
|
+
messageId: 'unsupportedNeeds',
|
|
338
|
+
data: {
|
|
339
|
+
value: stringifyValue(item)
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
284
346
|
context.report({
|
|
285
347
|
node,
|
|
286
348
|
messageId: 'unsupportedNeeds',
|
|
287
349
|
data: {
|
|
288
|
-
value: node.value
|
|
350
|
+
value: stringifyValue(node.value)
|
|
289
351
|
}
|
|
290
352
|
});
|
|
291
353
|
}
|
|
@@ -295,11 +357,49 @@ const create$7 = context => {
|
|
|
295
357
|
|
|
296
358
|
const needs = {
|
|
297
359
|
__proto__: null,
|
|
298
|
-
create: create$
|
|
299
|
-
meta: meta$
|
|
360
|
+
create: create$a,
|
|
361
|
+
meta: meta$a
|
|
300
362
|
};
|
|
301
363
|
|
|
302
|
-
const meta$
|
|
364
|
+
const meta$9 = {
|
|
365
|
+
type: 'problem',
|
|
366
|
+
docs: {
|
|
367
|
+
description: 'Disallow unsupported node version file values'
|
|
368
|
+
},
|
|
369
|
+
messages: {
|
|
370
|
+
unsupportedNodeVersionFile: 'Unsupported node version file value: {{value}}'
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
const create$9 = context => {
|
|
374
|
+
const sourceCode = getSourceCode(context);
|
|
375
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
376
|
+
return {};
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
YAMLPair(node) {
|
|
380
|
+
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') {
|
|
381
|
+
const nodeValue = node.value.value;
|
|
382
|
+
if (typeof nodeValue !== 'string' || nodeValue !== '.nvmrc') {
|
|
383
|
+
context.report({
|
|
384
|
+
node,
|
|
385
|
+
messageId: 'unsupportedNodeVersionFile',
|
|
386
|
+
data: {
|
|
387
|
+
value: nodeValue
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const nodeVersionFile = {
|
|
397
|
+
__proto__: null,
|
|
398
|
+
create: create$9,
|
|
399
|
+
meta: meta$9
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const meta$8 = {
|
|
303
403
|
type: 'problem',
|
|
304
404
|
docs: {
|
|
305
405
|
description: 'Disallow unsupported npm registry values'
|
|
@@ -308,7 +408,7 @@ const meta$6 = {
|
|
|
308
408
|
unsupportedNpmRegistry: 'Unsupported npm registry value: {{value}}'
|
|
309
409
|
}
|
|
310
410
|
};
|
|
311
|
-
const create$
|
|
411
|
+
const create$8 = context => {
|
|
312
412
|
const sourceCode = getSourceCode(context);
|
|
313
413
|
if (!sourceCode.parserServices?.isYAML) {
|
|
314
414
|
return {};
|
|
@@ -333,11 +433,11 @@ const create$6 = context => {
|
|
|
333
433
|
|
|
334
434
|
const npmRegistry = {
|
|
335
435
|
__proto__: null,
|
|
336
|
-
create: create$
|
|
337
|
-
meta: meta$
|
|
436
|
+
create: create$8,
|
|
437
|
+
meta: meta$8
|
|
338
438
|
};
|
|
339
439
|
|
|
340
|
-
const meta$
|
|
440
|
+
const meta$7 = {
|
|
341
441
|
type: 'problem',
|
|
342
442
|
docs: {
|
|
343
443
|
description: 'Disallow unsupported npm commands'
|
|
@@ -354,7 +454,7 @@ const isSupportedNpmCommand = value => {
|
|
|
354
454
|
}
|
|
355
455
|
return false;
|
|
356
456
|
};
|
|
357
|
-
const create$
|
|
457
|
+
const create$7 = context => {
|
|
358
458
|
const sourceCode = getSourceCode(context);
|
|
359
459
|
if (!sourceCode.parserServices?.isYAML) {
|
|
360
460
|
return {};
|
|
@@ -382,11 +482,11 @@ const create$5 = context => {
|
|
|
382
482
|
|
|
383
483
|
const npm = {
|
|
384
484
|
__proto__: null,
|
|
385
|
-
create: create$
|
|
386
|
-
meta: meta$
|
|
485
|
+
create: create$7,
|
|
486
|
+
meta: meta$7
|
|
387
487
|
};
|
|
388
488
|
|
|
389
|
-
const meta$
|
|
489
|
+
const meta$6 = {
|
|
390
490
|
type: 'problem',
|
|
391
491
|
docs: {
|
|
392
492
|
description: 'Disallow unsupported on values'
|
|
@@ -395,7 +495,7 @@ const meta$4 = {
|
|
|
395
495
|
unsupportedOn: 'Unsupported on value: {{value}}'
|
|
396
496
|
}
|
|
397
497
|
};
|
|
398
|
-
const create$
|
|
498
|
+
const create$6 = context => {
|
|
399
499
|
const sourceCode = getSourceCode(context);
|
|
400
500
|
if (!sourceCode.parserServices?.isYAML) {
|
|
401
501
|
return {};
|
|
@@ -422,11 +522,11 @@ const create$4 = context => {
|
|
|
422
522
|
|
|
423
523
|
const on = {
|
|
424
524
|
__proto__: null,
|
|
425
|
-
create: create$
|
|
426
|
-
meta: meta$
|
|
525
|
+
create: create$6,
|
|
526
|
+
meta: meta$6
|
|
427
527
|
};
|
|
428
528
|
|
|
429
|
-
const meta$
|
|
529
|
+
const meta$5 = {
|
|
430
530
|
type: 'problem',
|
|
431
531
|
docs: {
|
|
432
532
|
description: 'Disallow unsupported permission values'
|
|
@@ -435,7 +535,7 @@ const meta$3 = {
|
|
|
435
535
|
unsupportedPermission: 'Unsupported permission value: {{value}}'
|
|
436
536
|
}
|
|
437
537
|
};
|
|
438
|
-
const create$
|
|
538
|
+
const create$5 = context => {
|
|
439
539
|
const sourceCode = getSourceCode(context);
|
|
440
540
|
if (!sourceCode.parserServices?.isYAML) {
|
|
441
541
|
return {};
|
|
@@ -477,11 +577,49 @@ const create$3 = context => {
|
|
|
477
577
|
|
|
478
578
|
const permissions = {
|
|
479
579
|
__proto__: null,
|
|
480
|
-
create: create$
|
|
481
|
-
meta: meta$
|
|
580
|
+
create: create$5,
|
|
581
|
+
meta: meta$5
|
|
482
582
|
};
|
|
483
583
|
|
|
484
|
-
const meta$
|
|
584
|
+
const meta$4 = {
|
|
585
|
+
type: 'problem',
|
|
586
|
+
docs: {
|
|
587
|
+
description: 'Disallow unsupported python versions'
|
|
588
|
+
},
|
|
589
|
+
messages: {
|
|
590
|
+
unsupportedPythonVersion: 'Unsupported python version: {{value}}'
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const create$4 = context => {
|
|
594
|
+
const sourceCode = getSourceCode(context);
|
|
595
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
596
|
+
return {};
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
YAMLPair(node) {
|
|
600
|
+
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 === 'python-version' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
601
|
+
const nodeValue = node.value.value;
|
|
602
|
+
if (typeof nodeValue !== 'string' || !pythonVersions.includes(nodeValue)) {
|
|
603
|
+
context.report({
|
|
604
|
+
node,
|
|
605
|
+
messageId: 'unsupportedPythonVersion',
|
|
606
|
+
data: {
|
|
607
|
+
value: nodeValue
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
const pythonVersion = {
|
|
617
|
+
__proto__: null,
|
|
618
|
+
create: create$4,
|
|
619
|
+
meta: meta$4
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const meta$3 = {
|
|
485
623
|
type: 'problem',
|
|
486
624
|
docs: {
|
|
487
625
|
description: 'Disallow unsupported shell values'
|
|
@@ -490,7 +628,7 @@ const meta$2 = {
|
|
|
490
628
|
unsupportedShell: 'Unsupported shell value: {{value}}'
|
|
491
629
|
}
|
|
492
630
|
};
|
|
493
|
-
const create$
|
|
631
|
+
const create$3 = context => {
|
|
494
632
|
const sourceCode = getSourceCode(context);
|
|
495
633
|
if (!sourceCode.parserServices?.isYAML) {
|
|
496
634
|
return {};
|
|
@@ -515,11 +653,11 @@ const create$2 = context => {
|
|
|
515
653
|
|
|
516
654
|
const shell = {
|
|
517
655
|
__proto__: null,
|
|
518
|
-
create: create$
|
|
519
|
-
meta: meta$
|
|
656
|
+
create: create$3,
|
|
657
|
+
meta: meta$3
|
|
520
658
|
};
|
|
521
659
|
|
|
522
|
-
const meta$
|
|
660
|
+
const meta$2 = {
|
|
523
661
|
type: 'problem',
|
|
524
662
|
docs: {
|
|
525
663
|
description: 'Disallow unsupported timeout minute values'
|
|
@@ -528,7 +666,7 @@ const meta$1 = {
|
|
|
528
666
|
unsupportedTimeoutMinutes: 'Unsupported timeout minutes value: {{value}}'
|
|
529
667
|
}
|
|
530
668
|
};
|
|
531
|
-
const create$
|
|
669
|
+
const create$2 = context => {
|
|
532
670
|
const sourceCode = getSourceCode(context);
|
|
533
671
|
if (!sourceCode.parserServices?.isYAML) {
|
|
534
672
|
return {};
|
|
@@ -550,6 +688,66 @@ const create$1 = context => {
|
|
|
550
688
|
};
|
|
551
689
|
|
|
552
690
|
const timeoutMinutes = {
|
|
691
|
+
__proto__: null,
|
|
692
|
+
create: create$2,
|
|
693
|
+
meta: meta$2
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
const meta$1 = {
|
|
697
|
+
type: 'problem',
|
|
698
|
+
docs: {
|
|
699
|
+
description: 'Disallow non-existing working directories'
|
|
700
|
+
},
|
|
701
|
+
messages: {
|
|
702
|
+
invalidWorkingDirectory: 'Working directory not found: {{value}}',
|
|
703
|
+
workingDirectoryMustBeOfTypeString: 'Working directory must be of type string'
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
const allowedNonExistingWorkingDirectories = ['dist', '.tmp'];
|
|
707
|
+
const isAllowedNonExistingWorkingDirectory = relativePath => {
|
|
708
|
+
for (const item of allowedNonExistingWorkingDirectories) {
|
|
709
|
+
if (relativePath.startsWith(item)) {
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return false;
|
|
714
|
+
};
|
|
715
|
+
const create$1 = context => {
|
|
716
|
+
const sourceCode = getSourceCode(context);
|
|
717
|
+
if (!sourceCode.parserServices?.isYAML) {
|
|
718
|
+
return {};
|
|
719
|
+
}
|
|
720
|
+
return {
|
|
721
|
+
YAMLPair(node) {
|
|
722
|
+
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 === 'working-directory' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
723
|
+
const nodeValue = node.value.value;
|
|
724
|
+
if (typeof nodeValue !== 'string') {
|
|
725
|
+
context.report({
|
|
726
|
+
node,
|
|
727
|
+
messageId: 'workingDirectoryMustBeOfTypeString',
|
|
728
|
+
data: {
|
|
729
|
+
value: nodeValue
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const path = resolve(context.cwd, nodeValue);
|
|
735
|
+
const relativePath = relative(context.cwd, path);
|
|
736
|
+
if (!isAllowedNonExistingWorkingDirectory(relativePath) && !existsSync(path)) {
|
|
737
|
+
context.report({
|
|
738
|
+
node,
|
|
739
|
+
messageId: 'invalidWorkingDirectory',
|
|
740
|
+
data: {
|
|
741
|
+
value: nodeValue
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
const workingDirectory = {
|
|
553
751
|
__proto__: null,
|
|
554
752
|
create: create$1,
|
|
555
753
|
meta: meta$1
|
|
@@ -558,10 +756,10 @@ const timeoutMinutes = {
|
|
|
558
756
|
const meta = {
|
|
559
757
|
type: 'problem',
|
|
560
758
|
docs: {
|
|
561
|
-
description: 'Disallow unsupported
|
|
759
|
+
description: 'Disallow unsupported github token values'
|
|
562
760
|
},
|
|
563
761
|
messages: {
|
|
564
|
-
|
|
762
|
+
unsupportedGithubToken: 'Unsupported github token value: {{value}}'
|
|
565
763
|
}
|
|
566
764
|
};
|
|
567
765
|
const create = context => {
|
|
@@ -571,12 +769,12 @@ const create = context => {
|
|
|
571
769
|
}
|
|
572
770
|
return {
|
|
573
771
|
YAMLPair(node) {
|
|
574
|
-
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 === '
|
|
772
|
+
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 === 'GITHUB_TOKEN' && node.value && typeof node.value === 'object' && 'type' in node.value && node.value.type === 'YAMLScalar') {
|
|
575
773
|
const nodeValue = node.value.value;
|
|
576
|
-
if (typeof nodeValue !== 'string' || nodeValue !== '.
|
|
774
|
+
if (typeof nodeValue !== 'string' || nodeValue !== '${{ secrets.GITHUB_TOKEN }}') {
|
|
577
775
|
context.report({
|
|
578
776
|
node,
|
|
579
|
-
messageId: '
|
|
777
|
+
messageId: 'unsupportedGithubToken',
|
|
580
778
|
data: {
|
|
581
779
|
value: nodeValue
|
|
582
780
|
}
|
|
@@ -587,7 +785,7 @@ const create = context => {
|
|
|
587
785
|
};
|
|
588
786
|
};
|
|
589
787
|
|
|
590
|
-
const
|
|
788
|
+
const githubToken = {
|
|
591
789
|
__proto__: null,
|
|
592
790
|
create,
|
|
593
791
|
meta
|
|
@@ -602,10 +800,13 @@ const plugin = {
|
|
|
602
800
|
'action-versions': actionVersions,
|
|
603
801
|
'ci-versions': ciVersions,
|
|
604
802
|
'fail-fast': failFast,
|
|
803
|
+
'github-token': githubToken,
|
|
605
804
|
'max-parallel': maxParallel,
|
|
606
805
|
'node-version-file': nodeVersionFile,
|
|
607
806
|
'npm-registry': npmRegistry,
|
|
807
|
+
'python-version': pythonVersion,
|
|
608
808
|
'timeout-minutes': timeoutMinutes,
|
|
809
|
+
'working-directory': workingDirectory,
|
|
609
810
|
matrix: matrix,
|
|
610
811
|
needs: needs,
|
|
611
812
|
npm: npm,
|
|
@@ -626,6 +827,7 @@ const recommended = [{
|
|
|
626
827
|
'github-actions/action-versions': 'error',
|
|
627
828
|
'github-actions/ci-versions': 'error',
|
|
628
829
|
'github-actions/fail-fast': 'error',
|
|
830
|
+
'github-actions/github-token': 'error',
|
|
629
831
|
'github-actions/matrix': 'off',
|
|
630
832
|
'github-actions/max-parallel': 'error',
|
|
631
833
|
'github-actions/needs': 'error',
|
|
@@ -635,7 +837,8 @@ const recommended = [{
|
|
|
635
837
|
'github-actions/on': 'error',
|
|
636
838
|
'github-actions/permissions': 'off',
|
|
637
839
|
'github-actions/shell': 'error',
|
|
638
|
-
'github-actions/timeout-minutes': 'error'
|
|
840
|
+
'github-actions/timeout-minutes': 'error',
|
|
841
|
+
'github-actions/working-directory': 'error'
|
|
639
842
|
}
|
|
640
843
|
}];
|
|
641
844
|
|