base_ref global expression

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-10-22 13:14:38 +02:00
parent a287d15e54
commit 09666f941b
11 changed files with 929 additions and 10 deletions

View File

@ -340,6 +340,15 @@ export class Meta {
sha: function () {
return ctx.sha.substr(0, 7);
},
base_ref: function () {
if (/^refs\/tags\//.test(ctx.ref)) {
return ctx.payload?.base_ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
}
if (/^refs\/pull\//.test(ctx.ref)) {
return ctx.payload?.pull_request?.base?.ref;
}
return '';
},
date: function (format) {
return moment(currentDate).utc().format(format);
}