Skip to content

Commit 1927001

Browse files
Malmahrouqi3Malmahrouqi3github-actions[bot]Gui-FernandesBRMateusStano
authored
ENH: Auto Populate Changelog (#919)
* Create changelog.yml for release drafting Add changelog.yml for processing merged PRs. * new workflow * Change branch reference for changelog update * Update auto-assign.yml * Fix typo in changelog.yml conditional statement * Update README with main features section Added new section for main features of RocketPy. * docs: update changelog for PR #3 * Enhance community section in README Added emphasis to the community invitation. * docs: update changelog for PR #4 * Update README with RocketPy import example Added import statement example for RocketPy classes. * docs: update changelog for PR #5 * Fix typo in changelog commit message * Update .gitignore * DOC: Ipdate Changelog for PR #6 * Fix typo in changelog commit message * Add branch filter for changelog workflow * Update README with aerodynamic models section * Change target branch for pull request workflow * DOC: Update Changelog for PR #7 * updating new things * Remove floating point precision fix entry from CHANGELOG Removed entry for floating point precision errors from changelog. * re-org * Few adjustments to work on the base repo, develop branch. * new changes * restored stuff * doc changes * updated changelog for this PR * updated changelog * PR # included in changelog * DOC: clearer words and corrected grammar * ENH: Updated changelog.yml to include permissions --------- Co-authored-by: Malmahrouqi3 <mohdsaid497566@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Co-authored-by: Mateus Stano Junqueira <69485049+MateusStano@users.noreply.github.com>
1 parent de29100 commit 1927001

4 files changed

Lines changed: 73 additions & 10 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Populate Changelog
2+
on:
3+
pull_request:
4+
types: [closed]
5+
branches:
6+
- develop
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
Changelog:
13+
if: github.event.pull_request.merged == true
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Clone RocketPy
18+
uses: actions/checkout@main
19+
with:
20+
repository: RocketPy-Team/RocketPy
21+
ref: develop
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Update Changelog
25+
env:
26+
PR_TITLE: ${{ github.event.pull_request.title }}
27+
PR_NUMBER: ${{ github.event.pull_request.number }}
28+
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
29+
run: |
30+
SECTION="### Added"
31+
PREFIX="ENH"
32+
33+
if [[ "$PR_LABELS" == *"Bug"* ]]; then
34+
SECTION="### Fixed"
35+
PREFIX="BUG"
36+
elif [[ "$PR_LABELS" == *"Refactor"* ]]; then
37+
SECTION="### Changed"
38+
PREFIX="MNT"
39+
elif [[ "$PR_LABELS" == *"Docs"* ]] && [[ "$PR_LABELS" == *"Git housekeeping"* ]]; then
40+
SECTION="### Changed"
41+
PREFIX="DOC"
42+
elif [[ "$PR_LABELS" == *"Tests"* ]]; then
43+
SECTION="### Changed"
44+
PREFIX="TST"
45+
elif [[ "$PR_LABELS" == *"Docs"* ]]; then
46+
# Only documentation -> Added section
47+
SECTION="### Added"
48+
PREFIX="DOC"
49+
fi
50+
51+
ENTRY="- $PREFIX: $PR_TITLE [#$PR_NUMBER](https://github.com/RocketPy-Team/RocketPy/pull/$PR_NUMBER)"
52+
SECTION_LINE=$(grep -n "^$SECTION$" CHANGELOG.md | head -1 | cut -d: -f1)
53+
54+
sed -i "$((SECTION_LINE + 1))a\\$ENTRY" CHANGELOG.md
55+
56+
- name: Push Changes
57+
run: |
58+
git config user.name "github-actions[bot]"
59+
git config user.email "github-actions[bot]@users.noreply.github.com"
60+
git add CHANGELOG.md
61+
git commit -m "DOC: Update Changelog for PR #${{ github.event.pull_request.number }}"
62+
git push

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Attention: The newest changes should be on top -->
3232

3333
### Added
3434

35+
- ENH: Auto Populate Changelog [#919](https://github.com/RocketPy-Team/RocketPy/pull/919)
3536
- ENH: Adaptive Monte Carlo via Convergence Criteria [#922](https://github.com/RocketPy-Team/RocketPy/pull/922)
3637
- TST: Add acceptance tests for 3DOF flight simulation based on Bella Lui rocket [#914](https://github.com/RocketPy-Team/RocketPy/pull/914)
3738

docs/development/first_pr.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,13 @@ The CHANGELOG file
9696
------------------
9797

9898
We keep track of the changes in the ``CHANGELOG.md`` file.
99-
When you open a PR, you should add a new entry to the "Unreleased" section of the file.
100-
This entry should simply be the title of your PR.
99+
When you open a PR, you should see the "Unreleased" section of the file.
100+
An entry will simply contain the title of your PR if merged.
101101

102102
.. note::
103103

104-
In the future we would like to automate the CHANGELOG update, but for now \
105-
it is a manual process, unfortunately.
106-
104+
The CHANGELOG is auto-updated once a PR is merged based on the associated labels, \
105+
which are assigned by the maintainers.
107106

108107
The review process
109108
------------------

docs/development/style_guide.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,16 @@ Standard acronyms to start the commit message with are::
162162
Pull Requests
163163
^^^^^^^^^^^^^
164164

165-
When opening a Pull Request, the name of the PR should be clear and concise.
166-
Similarly to the commit messages, the PR name should start with an acronym indicating the type of PR
167-
and then a brief description of the changes.
165+
When opening a Pull Request, the title should be clear and concise.
166+
It should contain only a brief desctiption of the changes without the acronym (e.g. ENH:, BUG:).
167+
The maintainers will label your PR accordingly, which will add a prefix via a workflow to indicate
168+
type of the PR in the CHANGELOG file.
168169

169170
Here is an example of a good PR name:
170171

171-
- ``BUG: fix the Frequency Response plot of the Flight class``
172+
- ``fix the Frequency Response plot of the Flight class``
172173

173-
The PR description explain the changes and motivation behind them. There is a template \
174+
The PR description explains the changes and motivation behind them. There is a template \
174175
available when opening a PR that can be used to guide you through the process of both \
175176
describing the changes and making sure all the necessary steps were taken. Of course, \
176177
you can always modify the template or add more information if you think it is necessary.

0 commit comments

Comments
 (0)