@@ -8,6 +8,7 @@ import {splitAllowedContext} from "@actions/workflow-parser/templates/allowed-co
88import { BasicExpressionToken } from "@actions/workflow-parser/templates/tokens/basic-expression-token" ;
99import { StringToken } from "@actions/workflow-parser/templates/tokens/string-token" ;
1010import { TemplateToken } from "@actions/workflow-parser/templates/tokens/template-token" ;
11+ import { MappingToken } from "@actions/workflow-parser/templates/tokens/mapping-token" ;
1112import { TokenRange } from "@actions/workflow-parser/templates/tokens/token-range" ;
1213import { File } from "@actions/workflow-parser/workflows/file" ;
1314import { FileProvider } from "@actions/workflow-parser/workflows/file-provider" ;
@@ -155,7 +156,8 @@ async function additionalValidations(
155156 // Validate action metadata (inputs, required fields) for regular steps
156157 if ( token . definition ?. key === "regular-step" && token . range ) {
157158 const context = getProviderContext ( documentUri , template , root , token . range ) ;
158- await validateAction ( diagnostics , token , context . step , config ) ;
159+ const indentSize = detectIndentSize ( root as MappingToken ) ;
160+ await validateAction ( diagnostics , token , context . step , config , indentSize ) ;
159161 }
160162
161163 // Validate job-level reusable workflow uses field format
@@ -783,3 +785,26 @@ function getStaticConcurrencyGroup(token: TemplateToken | undefined): StringToke
783785
784786 return undefined ;
785787}
788+
789+ function detectIndentSize ( rootToken : MappingToken ) : number {
790+ // Find the "jobs" key in the root mapping to get its column position
791+ let jobsKeyColumn : number | undefined ;
792+ let jobsValue : TemplateToken | undefined ;
793+
794+ for ( const { key, value} of rootToken ) {
795+ if ( key . toString ( ) === "jobs" ) {
796+ jobsKeyColumn = key . range ?. start . column ;
797+ jobsValue = value ;
798+ break ;
799+ }
800+ }
801+
802+ if ( jobsKeyColumn !== undefined && jobsValue && isMapping ( jobsValue ) && jobsValue . count > 0 ) {
803+ const firstJob = jobsValue . get ( 0 ) ;
804+ if ( firstJob ?. key . range ) {
805+ return firstJob . key . range . start . column - jobsKeyColumn ;
806+ }
807+ }
808+
809+ return 2 ; // fallback
810+ }
0 commit comments