Skip to content

Commit 4a99b4e

Browse files
committed
CIHelper.setupGitHubAction(): also process the SMTP inputs, if any
The upcoming `handle-pr-comment` Action wants to send emails, and for that reason needs to accept SMTP credentials. These can be provided via the `smtp-host`, `smtp-user` and `smtp-pass` Action inputs. Additional options (that might be necessary to support projects other than Git) can be passed in via the `smtp-opts` input, a JSON-formatted object to augment/oeverride nodemailer's `SMTPTransport.Options` when sending the emails. Since most of GitGitGadget's Actions do not want to send emails, it is silently ignored if these Action inputs are unset or empty when `setupGitHubAction()` is called. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 7d538e5 commit 4a99b4e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/ci-helper.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,21 @@ export class CIHelper {
9090
this.setAccessToken(this.config.repo.testOwner, core.getInput("test-repo-token"));
9191
}
9292

93+
// set the SMTP options
94+
try {
95+
const options = {
96+
smtpUser: core.getInput("smtp-user"),
97+
smtpHost: core.getInput("smtp-host"),
98+
smtpPass: core.getInput("smtp-pass"),
99+
smtpOpts: core.getInput("smtp-opts"),
100+
};
101+
if (options.smtpUser && options.smtpHost && options.smtpPass) {
102+
this.setSMTPOptions(options);
103+
}
104+
} catch (e) {
105+
// Ignore, for now
106+
}
107+
93108
// eslint-disable-next-line security/detect-non-literal-fs-filename
94109
if (!fs.existsSync(this.workDir)) await git(["init", "--bare", "--initial-branch", "unused", this.workDir]);
95110
for (const [key, value] of [

0 commit comments

Comments
 (0)