mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-22 03:59:33 +01:00
Merge pull request #198 from crazy-max/refactor-default-banch
don't handle default branch global exp for pr events
This commit is contained in:
commit
be6d2cc1df
5 changed files with 7 additions and 19 deletions
|
@ -693,9 +693,6 @@ workflow run. Will be empty for a branch reference:
|
||||||
Returns `true` if the branch that triggered the workflow run is the default
|
Returns `true` if the branch that triggered the workflow run is the default
|
||||||
one, otherwise `false`.
|
one, otherwise `false`.
|
||||||
|
|
||||||
Will compare against the branch name that triggered the workflow run or the
|
|
||||||
base ref for a pull request.
|
|
||||||
|
|
||||||
#### `{{date '<format>'}}`
|
#### `{{date '<format>'}}`
|
||||||
|
|
||||||
Returns the current date rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/).
|
Returns the current date rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/).
|
||||||
|
|
|
@ -2327,14 +2327,11 @@ describe('pr', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'mytag-master',
|
main: 'mytag-master',
|
||||||
partial: [
|
partial: [],
|
||||||
'mytag-defbranch'
|
|
||||||
],
|
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:mytag-master',
|
'org/app:mytag-master'
|
||||||
'org/app:mytag-defbranch'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
@ -2359,14 +2356,11 @@ describe('pr', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'mytag-master',
|
main: 'mytag-master',
|
||||||
partial: [
|
partial: [],
|
||||||
'mytag-defbranch'
|
|
||||||
],
|
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'org/app:mytag-master',
|
'org/app:mytag-master'
|
||||||
'org/app:mytag-defbranch'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"org.opencontainers.image.title=Hello-World",
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
|
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
|
@ -377,7 +377,7 @@ export class Meta {
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
is_default_branch: function () {
|
is_default_branch: function () {
|
||||||
let branch = ctx.ref.replace(/^refs\/heads\//g, '');
|
const branch = ctx.ref.replace(/^refs\/heads\//g, '');
|
||||||
// TODO: "base_ref" is available in the push payload but doesn't always seem to
|
// TODO: "base_ref" is available in the push payload but doesn't always seem to
|
||||||
// return the expected branch when the push tag event occurs. It's also not
|
// return the expected branch when the push tag event occurs. It's also not
|
||||||
// documented in GitHub docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
|
// documented in GitHub docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
|
||||||
|
@ -385,9 +385,6 @@ export class Meta {
|
||||||
// if (/^refs\/tags\//.test(ctx.ref) && ctx.payload?.base_ref != undefined) {
|
// if (/^refs\/tags\//.test(ctx.ref) && ctx.payload?.base_ref != undefined) {
|
||||||
// branch = ctx.payload.base_ref.replace(/^refs\/heads\//g, '');
|
// branch = ctx.payload.base_ref.replace(/^refs\/heads\//g, '');
|
||||||
// }
|
// }
|
||||||
if (/^refs\/pull\//.test(ctx.ref) && ctx.payload?.pull_request?.base?.ref != undefined) {
|
|
||||||
branch = ctx.payload.pull_request.base.ref;
|
|
||||||
}
|
|
||||||
if (branch == undefined || branch.length == 0) {
|
if (branch == undefined || branch.length == 0) {
|
||||||
return 'false';
|
return 'false';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue