Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
25bdbb2b
Commit
25bdbb2b
authored
Dec 18, 2016
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
Use different branch naming and titles for major upgrades
parent
87cc6469
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/index.js
+23
-10
23 additions, 10 deletions
src/index.js
with
23 additions
and
10 deletions
src/index.js
+
23
−
10
View file @
25bdbb2b
...
...
@@ -90,16 +90,22 @@ function updateRepo({ token, repoName, packageFile }) {
const
latestAvailable
=
res
.
body
[
'
dist-tags
'
].
latest
;
if
(
semver
.
gt
(
latestAvailable
,
currentVersion
))
{
return
updateDependency
(
depType
,
depName
,
latestAvailable
)
let
majorUpgrade
=
false
;
if
(
semver
.
major
(
latestAvailable
)
!==
semver
.
major
(
currentVersion
))
{
majorUpgrade
=
true
;
}
return
updateDependency
(
depType
,
depName
,
latestAvailable
,
majorUpgrade
)
}
});
});
},
Promise
.
resolve
());
}
function
updateDependency
(
depType
,
depName
,
nextVersion
)
{
const
branchName
=
`upgrade/
${
depName
}
`
;
function
updateDependency
(
depType
,
depName
,
nextVersion
,
majorUpgrade
)
{
let
branchName
=
`upgrade/
${
depName
}
`
;
if
(
majorUpgrade
)
{
branchName
+=
'
-major
'
;
}
// try to checkout remote branche
try
{
nativeCall
(
`git checkout
${
branchName
}
`
);
...
...
@@ -107,11 +113,11 @@ function updateRepo({ token, repoName, packageFile }) {
nativeCall
(
`git checkout -b
${
branchName
}
`
);
}
return
updateBranch
(
branchName
,
depType
,
depName
,
nextVersion
)
return
updateBranch
(
branchName
,
depType
,
depName
,
nextVersion
,
majorUpgrade
)
.
then
(()
=>
nativeCall
(
`git checkout master`
));
}
function
updateBranch
(
branchName
,
depType
,
depName
,
nextVersion
)
{
function
updateBranch
(
branchName
,
depType
,
depName
,
nextVersion
,
majorUpgrade
)
{
let
commit
;
return
repo
.
getBranchCommit
(
branchName
)
...
...
@@ -129,12 +135,15 @@ function updateRepo({ token, repoName, packageFile }) {
pkg
[
depType
][
depName
]
=
nextVersion
;
fs
.
writeFileSync
(
`
${
repoPath
}
/
${
packageFile
}
`
,
JSON
.
stringify
(
pkg
,
null
,
2
)
+
'
\n
'
);
return
commitAndPush
(
commit
,
depName
,
nextVersion
,
branchName
);
return
commitAndPush
(
commit
,
depName
,
nextVersion
,
branchName
,
majorUpgrade
);
});
}
function
commitAndPush
(
commit
,
depName
,
nextVersion
,
branchName
)
{
const
updateMessage
=
`Update
${
depName
}
to version
${
nextVersion
}
`
;
function
commitAndPush
(
commit
,
depName
,
nextVersion
,
branchName
,
majorUpgrade
)
{
let
updateMessage
=
`Update
${
depName
}
to version
${
nextVersion
}
`
;
if
(
majorUpgrade
)
{
updateMessage
+=
'
(MAJOR)
'
;
}
console
.
log
(
updateMessage
);
let
index
;
...
...
@@ -176,7 +185,11 @@ function updateRepo({ token, repoName, packageFile }) {
);
})
.
then
(()
=>
{
return
createPullRequest
(
branchName
,
`Update
${
depName
}
`
);
let
prTitle
=
`Update
${
depName
}
`
;
if
(
majorUpgrade
)
{
prTitle
+=
'
(MAJOR)
'
;
}
return
createPullRequest
(
branchName
,
prTitle
);
});
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment