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
5 changed files with 579 additions and 4 deletions

8
dist/index.js generated vendored
View File

@ -533,10 +533,14 @@ class Meta {
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? true : this.flavor.latest == 'true');
}
procRefPr(version, tag) {
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');
}
procEdge(version, tag) {