Skip to content

Commit 3aa3286

Browse files
committed
Adding an example for mutating the changelog.
1 parent 4a06273 commit 3aa3286

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

README.md

+33-2
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,50 @@ Then you can use the resulting changelog:
7070
EOF
7171
```
7272
73+
### Simple output modifications
74+
75+
Some folks have asked if the action can support changing the output. For example:
76+
* Reverse order
77+
* Ignore entries that include this string.
78+
* Etc
79+
80+
In order to keep this action as simple as possible we aren't planning to add more flags or options. However since the output is just text you can write a command line to do anything you want. In issue #93 we had a user that wanted to list the changelog in reverse order and drop any entries with `gh-pages`. Here is how they can do that but using Bumping as the restrict word because it shows up in this projects history:
81+
82+
```yaml
83+
- name: Modify the changelog
84+
id: modified
85+
run: |
86+
set -o noglob
87+
log=$(cat << "EOF" | grep -v Bumping | tac
88+
${{ steps.changelog.outputs.changelog }}
89+
EOF
90+
)
91+
log="${log//'%'/'%25'}"
92+
log="${log//$'\n'/'%0A'}"
93+
log="${log//$'\r'/'%0D'}"
94+
echo "::set-output name=modified::$log"
95+
- name: Print the modified changelog
96+
run: |
97+
cat << "EOF"
98+
${{ steps.modified.outputs.modified }}
99+
EOF
100+
```
101+
102+
You might be wondering about that set of escaping for the `log`. Thats because GitHub Actions doesn't support multiline output. Read more [here](https://github.community/t/set-output-truncates-multiline-strings/16852).
103+
73104
## Example use case
74105

75106
[Generating the release notes for a GitHub Release.](.github/workflows/release.yml)
76107

77108
## Open Discussions for feature requests or questions
78109

79-
Issues are for folks who are actively using the action and running into an "issue" (bug, missing doc, etc).
110+
Issues are for folks who are actively using the action and running into an "issue" (bug, missing doc, etc).
80111

81112
Feature requests should be in the [discussion section.](https://github.com/metcalfc/changelog-generator/discussions).
82113
Just to set expectations the bar for a new feature getting added is going to be very high. There is a
83114
cost to adding features in the development and maintainance of the feature. So if you want to jump in and
84115
help develop and maintain lets discuss. If you want to fire off feature ideas, go for it. Just understand its
85-
very likely that without someone willing to take up the task, they won't get implemented.
116+
very likely that without someone willing to take up the task, they won't get implemented.
86117

87118
## Keep up-to-date with GitHub Dependabot
88119

0 commit comments

Comments
 (0)