mirror of
https://github.com/docker/metadata-action.git
synced 2024-12-22 17:45:39 +00:00
fix undefined base_ref for some events
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
89bf6c030f
commit
7d7a22a682
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -366,11 +366,11 @@ export class Meta {
|
|||
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\/tags\//.test(ctx.ref) && ctx.payload?.base_ref != undefined) {
|
||||
return ctx.payload.base_ref.replace(/^refs\/heads\//g, '').replace(/\//g, '-');
|
||||
}
|
||||
if (/^refs\/pull\//.test(ctx.ref)) {
|
||||
return ctx.payload?.pull_request?.base?.ref;
|
||||
if (/^refs\/pull\//.test(ctx.ref) && ctx.payload?.pull_request?.base?.ref != undefined) {
|
||||
return ctx.payload.pull_request.base.ref;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue