Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
devops
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osm
devops
Commits
4f52455f
Commit
4f52455f
authored
7 years ago
by
Mike Marchetti
Browse files
Options
Downloads
Patches
Plain Diff
update generation in case no tag is found
Signed-off-by:
Mike Marchetti
<
mmarchetti@sandvine.com
>
parent
a7481785
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/generatechangelog-pipeline.sh
+18
-10
18 additions, 10 deletions
tools/generatechangelog-pipeline.sh
with
18 additions
and
10 deletions
tools/generatechangelog-pipeline.sh
+
18
−
10
View file @
4f52455f
#!/bin/bash
REPO_NAME
=
$(
basename
$(
git config
--get
remote.origin.url
)
|
cut
-d
'.'
-f1
)
git pull
--tags
origin master &> /dev/null
echo
"<h1>
$REPO_NAME
Changelog</h1>"
# get the latest tag
TAG_START
=
$(
git tag |
sort
-Vr
|
head
-1
)
head_tag_diff
=
$(
git rev-list
$TAG_START
^HEAD |wc
-l
)
if
[
$head_tag_diff
-eq
0
]
;
then
# HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff
TAG_END
=
$TAG_START
TAG_START
=
$(
git tag |
sort
-Vr
|
head
-2
|
sort
-V
|
head
-1
)
# check to see if there is a tag start first.
if
[
!
-z
"
${
TAG_START
}
"
]
;
then
head_tag_diff
=
$(
git rev-list HEAD ^
${
TAG_START
}
|wc
-l
)
if
[
$head_tag_diff
-eq
0
]
;
then
# HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff
TAG_END
=
$TAG_START
TAG_START
=
$(
git tag |
sort
-Vr
|
head
-2
|
sort
-V
|
head
-1
)
else
TAG_END
=
"HEAD"
fi
echo
"<h2>tag:
${
TAG_START
}
->
${
TAG_END
}
</h2>"
git log
--pretty
=
format:
"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/
$REPO_NAME
.git;a=commitdiff;h=%H>%h •</a> %s</li> "
--reverse
${
TAG_START
}
..
${
TAG_END
}
else
TAG_END
=
"HEAD"
# no tag, just give the full log
git log
--pretty
=
format:
"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/
$REPO_NAME
.git;a=commitdiff;h=%H>%h •</a> %s</li> "
--reverse
fi
git pull
--tags
origin master &> /dev/null
echo
"<h1>
$REPO_NAME
Changelog</h1>"
echo
"<h2>tag:
${
TAG_START
}
->
${
TAG_END
}
</h2>"
git log
--pretty
=
format:
"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/
$REPO_NAME
.git;a=commitdiff;h=%H>%h •</a> %s</li> "
--reverse
${
TAG_START
}
..
${
TAG_END
}
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