Remove duplicate test file and fix expression bypass
- Remove duplicate test file (errors-job-environment-deployment-disabled-feature.yml)
- Move deployment feature flag check before expression skip so
deployment: ${{ ... }} is still gated by allowDeploymentKeyword
This commit is contained in:
@@ -23,6 +23,18 @@ export function convertToActionsEnvironmentRef(
|
|||||||
|
|
||||||
for (const property of environmentMapping) {
|
for (const property of environmentMapping) {
|
||||||
const propertyName = property.key.assertString("job environment key");
|
const propertyName = property.key.assertString("job environment key");
|
||||||
|
|
||||||
|
// Check deployment feature flag before skipping expressions,
|
||||||
|
// so deployment: ${{ ... }} is still gated by the flag
|
||||||
|
if (propertyName.value === "deployment") {
|
||||||
|
const featureFlags = context.state["featureFlags"] as FeatureFlags | undefined;
|
||||||
|
const flags = featureFlags ?? new FeatureFlags();
|
||||||
|
if (!flags.isEnabled("allowDeploymentKeyword")) {
|
||||||
|
context.error(property.key, `The key 'deployment' is not allowed`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (property.key.isExpression || property.value.isExpression) {
|
if (property.key.isExpression || property.value.isExpression) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -36,16 +48,9 @@ export function convertToActionsEnvironmentRef(
|
|||||||
result.url = property.value;
|
result.url = property.value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "deployment": {
|
case "deployment":
|
||||||
const featureFlags = context.state["featureFlags"] as FeatureFlags | undefined;
|
result.deployment = property.value;
|
||||||
const flags = featureFlags ?? new FeatureFlags();
|
|
||||||
if (flags.isEnabled("allowDeploymentKeyword")) {
|
|
||||||
result.deployment = property.value;
|
|
||||||
} else {
|
|
||||||
context.error(property.key, `The key 'deployment' is not allowed`);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user