File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ jobs:
278
278
type=raw,value=gexp-tag-{{tag}}
279
279
type=raw,value=gexp-baseref-{{base_ref}}
280
280
type=raw,value=gexp-defbranch,enable={{is_default_branch}}
281
+ type=raw,value=gexp-notdefbranch,enable={{is_not_default_branch}}
281
282
282
283
json :
283
284
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 44
44
* [ ` {{sha}} ` ] ( #sha )
45
45
* [ ` {{base_ref}} ` ] ( #base_ref )
46
46
* [ ` {{is_default_branch}} ` ] ( #is_default_branch )
47
+ * [ ` {{is_not_default_branch}} ` ] ( #is_not_default_branch )
47
48
* [ ` {{date '<format>' tz='<timezone>'}} ` ] ( #date-format-tztimezone )
48
49
* [ ` {{commit_date '<format>' tz='<timezone>'}} ` ] ( #commit_date-format-tztimezone )
49
50
* [ Major version zero] ( #major-version-zero )
@@ -874,6 +875,11 @@ workflow run. Will be empty for a branch reference:
874
875
Returns `true` if the branch that triggered the workflow run is the default
875
876
one, otherwise `false`.
876
877
878
+ # ### `{{is_not_default_branch}}`
879
+
880
+ Returns `true` if the branch that triggered the workflow run is not the default
881
+ one, otherwise `false`.
882
+
877
883
# ### `{{date '<format>' tz='<timezone>'}}`
878
884
879
885
Returns the current date rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/).
Original file line number Diff line number Diff line change @@ -821,6 +821,40 @@ describe('push', () => {
821
821
"org.opencontainers.image.version=mytag-master"
822
822
] ,
823
823
undefined
824
+ ] ,
825
+ [
826
+ 'push22' ,
827
+ 'event_push_dev.env' ,
828
+ {
829
+ images : [ 'org/app' ] ,
830
+ tags : [
831
+ `type=edge,branch=master` ,
832
+ `type=sha,format=long` ,
833
+ `type=raw,value=notdefbranch,enable={{is_not_default_branch}}`
834
+ ] ,
835
+ } as Inputs ,
836
+ {
837
+ main : 'notdefbranch' ,
838
+ partial : [
839
+ 'sha-860c1904a1ce19322e91ac35af1ab07466440c37'
840
+ ] ,
841
+ latest : false
842
+ } as Version ,
843
+ [
844
+ "org/app:notdefbranch" ,
845
+ "org/app:sha-860c1904a1ce19322e91ac35af1ab07466440c37"
846
+ ] ,
847
+ [
848
+ "org.opencontainers.image.created=2020-01-10T00:30:00.000Z" ,
849
+ "org.opencontainers.image.description=This your first repo!" ,
850
+ "org.opencontainers.image.licenses=MIT" ,
851
+ "org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37" ,
852
+ "org.opencontainers.image.source=https://github.com/octocat/Hello-World" ,
853
+ "org.opencontainers.image.title=Hello-World" ,
854
+ "org.opencontainers.image.url=https://github.com/octocat/Hello-World" ,
855
+ "org.opencontainers.image.version=notdefbranch"
856
+ ] ,
857
+ undefined
824
858
]
825
859
] ) ( 'given %p with %p event' , tagsLabelsTest ) ;
826
860
} ) ;
Original file line number Diff line number Diff line change @@ -439,6 +439,9 @@ export class Meta {
439
439
}
440
440
return 'false' ;
441
441
} ,
442
+ is_not_default_branch : function ( ) {
443
+ return this . is_default_branch ( ) === 'false' ? 'true' : 'false' ;
444
+ } ,
442
445
date : function ( format , options ) {
443
446
const m = moment ( currentDate ) ;
444
447
let tz = 'UTC' ;
You can’t perform that action at this time.
0 commit comments