2
0
Fork 0
mirror of https://code.forgejo.org/docker/metadata-action.git synced 2025-08-26 16:00:54 +00:00

Handle pull_request_target event

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-05-23 03:54:23 +02:00
parent e856afadf9
commit 4d088f5efc
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 579 additions and 4 deletions

View file

@ -191,10 +191,15 @@ export class Meta {
}
private procRefPr(version: Version, tag: tcl.Tag): Version {
if (!/^refs\/pull\//.test(this.context.ref)) {
let ref = this.context.ref;
if (/pull_request_target/.test(this.context.eventName)) {
ref = `refs/pull/${this.context.payload.number}/merge`;
}
if (!/^refs\/pull\//.test(ref)) {
return version;
}
const vraw = this.setValue(this.context.ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, ''), tag);
const vraw = this.setValue(ref.replace(/^refs\/pull\//g, '').replace(/\/merge$/g, ''), tag);
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? false : this.flavor.latest == 'true');
}