Skip to content

Commit

Permalink
Fix read-yaml ReferenceError (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Feb 24, 2022
1 parent 9e13c60 commit 6ca0980
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion read-yaml/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ runs:
core.setOutput("scopes", data);
} else {
for (const scope in scopes) {
core.info(`loading \u001b[36;1m${scopes[scope]}\u001b[m as \u001b[36;1m${scope}\u001b[m ("${value.split(/\r?\n/)[0].slice(0, 10)}...")`);
let value = data;
try {
for (const key of scopes[scope].split('.'))
value = value instanceof Array ? value[parseInt(key)] : value[key];
} catch (err) {
throw new Error(`Failed to read ${scopes[scope]} (${err.message})`);
}
core.info(`loading \u001b[36;1m${scopes[scope]}\u001b[m as \u001b[36;1m${scope}\u001b[m ("${value.split(/\r?\n/)[0].slice(0, 10)}...")`);
core.setOutput(scope, value);
}
}
Expand Down

0 comments on commit 6ca0980

Please sign in to comment.