mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:33:33 +00:00 
			
		
		
		
	Add ability to use package json version.
This will only work with top level package json file and not nested files.
This commit is contained in:
		
							parent
							
								
									146c4d84a5
								
							
						
					
					
						commit
						b59618b1f6
					
				
							
								
								
									
										12
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.ts
									
									
									
									
									
								
							@ -73,6 +73,18 @@ function resolveVersionInput(): string {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  if (version === "package") {
 | 
				
			||||||
 | 
					    const packageJson = JSON.parse(
 | 
				
			||||||
 | 
					      fs.readFileSync(
 | 
				
			||||||
 | 
					        path.join(
 | 
				
			||||||
 | 
					          process.env.GITHUB_WORKSPACE!, 
 | 
				
			||||||
 | 
					          "package.json"
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    return packageJson.engines.node;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (version) {
 | 
					  if (version) {
 | 
				
			||||||
    return version;
 | 
					    return version;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user