File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export async function run(): Promise<void> {
96
96
try {
97
97
// Get action inputs
98
98
const image = getInput ( 'image' ) ; // Image ie gcr.io/...
99
- const service = getInput ( 'service' ) ; // Service name
99
+ let service = getInput ( 'service' ) ; // Service name
100
100
const job = getInput ( 'job' ) ; // Job name
101
101
const metadata = getInput ( 'metadata' ) ; // YAML file
102
102
const projectId = getInput ( 'project_id' ) ;
@@ -156,6 +156,19 @@ export async function run(): Promise<void> {
156
156
const contents = await readFile ( metadata , 'utf8' ) ;
157
157
const parsed = parseYAML ( contents ) ;
158
158
159
+ // Extract service name from metadata template
160
+ const name = parsed ?. metadata ?. name ;
161
+ if ( ! name ) {
162
+ throw new Error ( `${ metadata } is missing 'metadata.name'` ) ;
163
+ }
164
+ if ( service !== '' && service != name ) {
165
+ throw new Error (
166
+ `service name in ${ metadata } ("${ name } ") does not match GitHub ` +
167
+ `Actions service input ("${ service } ")` ,
168
+ ) ;
169
+ }
170
+ service = name ;
171
+
159
172
const kind = parsed ?. kind ;
160
173
if ( kind === 'Service' ) {
161
174
deployCmd = [ 'run' , 'services' , 'replace' , metadata ] ;
You can’t perform that action at this time.
0 commit comments