62 ...inputAdo.ado
63 },
64 github: {
65 ...(configJSON && configJSON.github ? configJSON.github : {}), 66 ...inputGitHub.github
67 }
68 };
58 ...payload,
59 ...env,
60 ado: {
61 ...(configJSON && configJSON.ado ? configJSON.ado : {}), 62 ...inputAdo.ado
63 },
64 github: {
54 let inputAdo = !!core.getInput('ado') ? JSON.parse(core.getInput('ado')) : { ado: {}};
55 let inputGitHub = !!core.getInput('github') ? JSON.parse(core.getInput('github')) : { github: {}};
56 let config = {
57 log_level: (configJSON && configJSON.log_level ? configJSON.log_level : undefined), 58 ...payload,
59 ...env,
60 ado: {
26
27 // Temporary fix until support of PRs
28 if ((config.issue.node_id && config.issue.node_id.startsWith("PR_")) ||
29 (config.issue.nodeId && config.issue.nodeId.startsWith("PR_"))) { 30 // Log and skip PRs (comments)
31 log.info(`Action is performed on PR #${config.issue.number}. Skipping...`);
32 } else {
25 log.debug(config);
26
27 // Temporary fix until support of PRs
28 if ((config.issue.node_id && config.issue.node_id.startsWith("PR_")) || 29 (config.issue.nodeId && config.issue.nodeId.startsWith("PR_"))) {
30 // Log and skip PRs (comments)
31 log.info(`Action is performed on PR #${config.issue.number}. Skipping...`);
The optional chaining operator can be used to perform null checks before accessing a property, or calling a function.
Using &&
for this purpose is no longer required.
function getUsernameFromId(id: number): string | undefined {
const user = db.getUser(id)
return user && user.name
}
someFunc && someFunc()
// ^~~~ not necessary
maybeArray && maybeArray[index]
// ^~~~ not necessary
function getUsernameFromId(id: number): string | undefined {
const user = db.getUser(id)
return user?.name
}
someFunc?.()
maybeArray?.[index]