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
b6671e46
Commit
b6671e46
authored
Feb 24, 2021
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a few extra changelog API examples
This should make it a bit easier to understand how to use this API.
parent
9cd3d261
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
doc/api/repositories.md
doc/api/repositories.md
+40
-1
No files found.
doc/api/repositories.md
View file @
b6671e46
...
...
@@ -329,12 +329,51 @@ following tags:
If the
`version`
attribute is
`2.1.0`
, GitLab uses tag v2.0.0. And when the
version is
`1.1.1`
, or
`1.2.0`
, GitLab uses tag v1.1.0. The tag
`v1.0.0-pre1`
is
never used, because
it's a pre-release tag, and
pre-release tags are ignored.
never used, because pre-release tags are ignored.
If
`from`
is unspecified and no tag to use is found, the API produces an error.
To solve such an error, you must explicitly specify a value for the
`from`
attribute.
### Examples
For these examples we use the project ID 42, and assume the project is hosted on
GitLab.com. The example API token we use is
`token`
. We use
[
curl
](
https://curl.se/
)
to perform the HTTP requests.
Let's start with a basic example:
```
shell
curl
--header
"PRIVATE-TOKEN: token"
--data
"version=1.0.0"
"https://gitlab.com/api/v4/projects/42/repository/changelog"
```
This generates a changelog for version
`1.0.0`
. The start of the range of
commits to include is the tag of the last release. The end of the range is the
last commit on the target branch, which defaults to the project's default
branch. So if the last tag is
`v0.9.0`
, and the default branch is
`main`
, this
means the range of commits is
`v0.9.0..main`
.
If you want to generate the data on a different branch, you can do so as
follows:
```
shell
curl
--header
"PRIVATE-TOKEN: token"
--data
"version=1.0.0&branch=foo"
"https://gitlab.com/api/v4/projects/42/repository/changelog"
```
This generates the data on the
`foo`
branch.
A different trailer to use is specified as follows:
```
shell
curl
--header
"PRIVATE-TOKEN: token"
--data
"version=1.0.0&trailer=Type"
"https://gitlab.com/api/v4/projects/42/repository/changelog"
```
Or perhaps you want to store the results in a different file:
```
shell
curl
--header
"PRIVATE-TOKEN: token"
--data
"version=1.0.0&file=NEWS"
"https://gitlab.com/api/v4/projects/42/repository/changelog"
```
### How it works
Changelogs are generated based on commit titles. Commits are only included if
...
...
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