Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/assemble_changelog.yml

This file was deleted.

10 changes: 4 additions & 6 deletions changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ If you have implemented several features or bugfixes you should describe all of
You can choose any name for your changelog files because the GitHub action will rename files in
`changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR.

Every push to the main or release branch Assemble changelog GitHub action will be executed:

* collect all files from `changelog/unreleased`
* assemble the changelog like:
To view the changelog for the current branch, run the command `python3 scripts/changelog/assemble_changelog.py`.
This script will collect all the files in the `changelog/unreleased` directory and generate a changelog in the following format:

```
#### Features
Expand All @@ -47,11 +45,11 @@ Every push to the main or release branch Assemble changelog GitHub action will b
Some other changes
```

* write the changelog to the `changelog/unreleased/CHANGELOG.md` file
To view the changelog for the android auto project, run the command `python3 scripts/changelog/assemble_changelog.py --auto`.

Every release the release train app will:

* get changelog from `changelog/unreleased/CHANGELOG.md` file
* assemble the changelog by the script `python3 scripts/changelog/assemble_changelog.py`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add #!/usr/bin/env python3 to the top of the file, you can run script typing less 🙂

Suggested change
* assemble the changelog by the script `python3 scripts/changelog/assemble_changelog.py`
* assemble the changelog by the script `./scripts/changelog/assemble_changelog.py`

* add information about dependencies and compile changelog like:
```
## Mapbox Navigation SDK 1.1.1 - 13 December, 2022
Expand Down
50 changes: 20 additions & 30 deletions scripts/changelog/assemble_changelog.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import argparse
import os

import git


def get_changes(path):
changes = ''
Expand All @@ -25,36 +24,27 @@ def get_changes(path):
return changes.strip()


bugfixes = get_changes('changelog/unreleased/bugfixes/')
features = get_changes('changelog/unreleased/features/')
issues = get_changes('changelog/unreleased/issues/')
other = get_changes('changelog/unreleased/other/')

changelog = '#### Features\n' + features + '\n\n' + \
'#### Bug fixes and improvements\n' + bugfixes + '\n\n' + \
'#### Known issues :warning:\n' + issues + '\n\n' + \
'#### Other changes\n' + other

old_changelog = open('changelog/unreleased/CHANGELOG.md', 'r').read()
parser = argparse.ArgumentParser(description='Assemble changelog')
parser.add_argument('--auto', action='store_true', help='To assemble android auto changelog')
args = parser.parse_args()

if changelog != old_changelog:
open('changelog/unreleased/CHANGELOG.md', 'w').write(changelog)
repository = git.Repo('.')
repository.git.add('changelog/unreleased')
repository.index.commit('Assemble changelog file [skip ci]')
repository.remotes.origin.push().raise_if_error()
if args.auto:
auto_bugfixes = get_changes('libnavui-androidauto/changelog/unreleased/bugfixes/')
auto_features = get_changes('libnavui-androidauto/changelog/unreleased/features/')

auto_bugfixes = get_changes('libnavui-androidauto/changelog/unreleased/bugfixes/')
auto_features = get_changes('libnavui-androidauto/changelog/unreleased/features/')
auto_changelog = '#### Features\n' + auto_features + '\n\n' + \
'#### Bug fixes and improvements\n' + auto_bugfixes

auto_changelog = '#### Features\n' + auto_features + '\n\n' + \
'#### Bug fixes and improvements\n' + auto_bugfixes
print(auto_changelog)
else:
bugfixes = get_changes('changelog/unreleased/bugfixes/')
features = get_changes('changelog/unreleased/features/')
issues = get_changes('changelog/unreleased/issues/')
other = get_changes('changelog/unreleased/other/')

auto_old_changelog = open('libnavui-androidauto/changelog/unreleased/CHANGELOG.md', 'r').read()
changelog = '#### Features\n' + features + '\n\n' + \
'#### Bug fixes and improvements\n' + bugfixes + '\n\n' + \
'#### Known issues :warning:\n' + issues + '\n\n' + \
'#### Other changes\n' + other

if auto_changelog != auto_old_changelog:
open('libnavui-androidauto/changelog/unreleased/CHANGELOG.md', 'w').write(auto_changelog)
repository = git.Repo('.')
repository.git.add('libnavui-androidauto/changelog/unreleased')
repository.index.commit('Assemble auto changelog file [skip ci]')
repository.remotes.origin.push().raise_if_error()
print(changelog)