@lvce-editor/eslint-plugin-github-actions 13.0.0 → 13.2.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 +45 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -135,18 +135,19 @@ const create$f = context => {
|
|
|
135
135
|
YAMLScalar(node) {
|
|
136
136
|
if (node && node.type === 'YAMLScalar' && typeof node.value === 'string') {
|
|
137
137
|
for (const check of checks) {
|
|
138
|
-
if (node.value.startsWith(check.prefix)) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
if (!node.value.startsWith(check.prefix)) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const version = check.parseVersion(node.value);
|
|
142
|
+
const isSupported = check.isSupported(version);
|
|
143
|
+
if (!isSupported) {
|
|
144
|
+
context.report({
|
|
145
|
+
data: {
|
|
146
|
+
value: node.value
|
|
147
|
+
},
|
|
148
|
+
messageId: 'unsupportedCiVersion',
|
|
149
|
+
node
|
|
150
|
+
});
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
}
|
|
@@ -587,32 +588,33 @@ const create$5 = context => {
|
|
|
587
588
|
YAMLPair(node) {
|
|
588
589
|
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') {
|
|
589
590
|
for (const pair of node.value.pairs) {
|
|
590
|
-
if (pair.key
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
591
|
+
if (!pair.key || pair.key.type !== 'YAMLScalar' || typeof pair.key.value !== 'string') {
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
const supportedKey = Object.hasOwn(permissions$1, pair.key.value);
|
|
595
|
+
if (supportedKey) {
|
|
596
|
+
if (pair.value && pair.value.type === 'YAMLScalar' && typeof pair.value.value === 'string') {
|
|
597
|
+
const items = permissions$1[pair.key.value] || [];
|
|
598
|
+
if (!items.includes(pair.value.value)) {
|
|
599
|
+
context.report({
|
|
600
|
+
data: {
|
|
601
|
+
// @ts-ignore
|
|
602
|
+
value: pair.value
|
|
603
|
+
},
|
|
604
|
+
messageId: 'unsupportedPermission',
|
|
605
|
+
node
|
|
606
|
+
});
|
|
605
607
|
}
|
|
606
|
-
} else {
|
|
607
|
-
context.report({
|
|
608
|
-
data: {
|
|
609
|
-
// @ts-ignore
|
|
610
|
-
value: pair
|
|
611
|
-
},
|
|
612
|
-
messageId: 'unsupportedPermission',
|
|
613
|
-
node: pair.key
|
|
614
|
-
});
|
|
615
608
|
}
|
|
609
|
+
} else {
|
|
610
|
+
context.report({
|
|
611
|
+
data: {
|
|
612
|
+
// @ts-ignore
|
|
613
|
+
value: pair
|
|
614
|
+
},
|
|
615
|
+
messageId: 'unsupportedPermission',
|
|
616
|
+
node: pair.key
|
|
617
|
+
});
|
|
616
618
|
}
|
|
617
619
|
}
|
|
618
620
|
}
|
|
@@ -691,12 +693,13 @@ const create$3 = context => {
|
|
|
691
693
|
} = node;
|
|
692
694
|
edits.push(fixer.replaceText(node.value, 'softprops/action-gh-release@v2'));
|
|
693
695
|
for (const pair of parent.pairs) {
|
|
694
|
-
if (pair.key
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
696
|
+
if (!pair.key || pair.key.type !== 'YAMLScalar' || pair.key.value !== 'with' || pair.value?.type != 'YAMLMapping') {
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
const subPairs = pair.value.pairs;
|
|
700
|
+
for (const subPair of subPairs) {
|
|
701
|
+
if (subPair.key?.type === 'YAMLScalar' && subPair.key.value === 'release_name') {
|
|
702
|
+
edits.push(fixer.replaceText(subPair.key, 'name'));
|
|
700
703
|
}
|
|
701
704
|
}
|
|
702
705
|
}
|