Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fc1b5e7b
Commit
fc1b5e7b
authored
Mar 24, 2022
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the $CI_DEFAULT_BRANCH variable in the metadata Danger rule
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
96f3ea55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
danger/z_metadata/Dangerfile
danger/z_metadata/Dangerfile
+4
-4
No files found.
danger/z_metadata/Dangerfile
View file @
fc1b5e7b
...
...
@@ -2,7 +2,7 @@
# rubocop:disable Style/SignalException
DEFAULT_BRANCH
=
'master
'
default_branch
=
ENV
[
'CI_DEFAULT_BRANCH'
]
||
'main
'
if
gitlab
.
mr_body
.
size
<
5
fail
"Please provide a proper merge request description."
...
...
@@ -14,12 +14,12 @@ end
has_milestone
=
!
gitlab
.
mr_json
[
"milestone"
].
nil?
unless
has_milestone
||
(
helper
.
security_mr?
&&
helper
.
mr_target_branch
==
DEFAULT_BRANCH
)
unless
has_milestone
||
(
helper
.
security_mr?
&&
helper
.
mr_target_branch
==
default_branch
)
warn
"This merge request does not refer to an existing milestone."
,
sticky:
false
end
has_pick_into_stable_label
=
helper
.
mr_labels
.
find
{
|
label
|
label
.
start_with?
(
'Pick into'
)
}
if
helper
.
mr_target_branch
!=
DEFAULT_BRANCH
&&
!
has_pick_into_stable_label
&&
!
helper
.
security_mr?
warn
"Most of the time, merge requests should target `
#{
DEFAULT_BRANCH
}
`. Otherwise, please set the relevant `Pick into X.Y` label."
if
helper
.
mr_target_branch
!=
default_branch
&&
!
has_pick_into_stable_label
&&
!
helper
.
security_mr?
warn
"Most of the time, merge requests should target `
#{
default_branch
}
`. Otherwise, please set the relevant `Pick into X.Y` label."
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment