Skip to content

Commit a75ca53

Browse files
authored
chore: add config and workflows for release notes (#3148)
* chore: add config and workflows for release notes * chore: cleanup release notes on publish
1 parent da55ff3 commit a75ca53

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

.github/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- feature flagged
5+
categories:
6+
- title: New Features
7+
labels:
8+
- feat
9+
- title: Bug Fixes
10+
labels:
11+
- fix
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Release Notes are meant to be
2+
# displayed to users as part of the
3+
# auto-update process.
4+
#
5+
# The following workflow:
6+
# - removes the "by @username" and PR info
7+
# - removes the contributors section
8+
# - turn COMPASS-* and MONGOSH-* into links
9+
#
10+
name: Release Notes - Cleanup
11+
on:
12+
release:
13+
types: [published, edited]
14+
15+
jobs:
16+
cleanup_notes:
17+
name: Cleanup Notes
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Clean up notes
21+
run: |
22+
cat $GITHUB_EVENT_PATH | \
23+
jq -r .release.body | \
24+
sed 's/ by @.*//' | \
25+
grep -v 'New Contributors' | \
26+
grep -v '* @' | \
27+
grep -v '<!--' | \
28+
sed 's/COMPASS-[0-9]\{1,5\}/[&](https:\/\/jira.mongodb.org\/browse\/&)/g' | \
29+
sed 's/MONGOSH-[0-9]\{1,5\}/[&](https:\/\/jira.mongodb.org\/browse\/&)/g' \
30+
> RELEASE_NOTES.md
31+
32+
- name: Update release
33+
env:
34+
RELEASE_TAG: ${{ github.event.release.tag_name }}
35+
GITHUB_REPO: ${{ github.repository }}
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
gh release edit "${RELEASE_TAG}" \
39+
--repo "${GITHUB_REPO}" \
40+
--notes-file RELEASE_NOTES.md
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Prepare and validate a PR for auto-generated release notes:
2+
# - if the title starts with `feat` or `fix` adds the label (`feat`, `fix`) used
3+
# by the release notes to include the PR in the appropriate section.
4+
# - each PR that is a `feat` or `fix` must also include either a
5+
# `feature flagged` or `release notes` label, PRs that have the `feature flagged`
6+
# label will not be included in the release notes.
7+
#
8+
name: Release Notes - Labels
9+
on:
10+
pull_request:
11+
types: [opened, edited, labeled, unlabeled, synchronize]
12+
jobs:
13+
label:
14+
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
steps:
18+
- name: remove label
19+
uses: actions-ecosystem/action-remove-labels@v1
20+
with:
21+
labels: |
22+
fix
23+
feat
24+
25+
- name: add label based on title - fix
26+
if: |
27+
startsWith(github.event.pull_request.title, 'fix:') ||
28+
startsWith(github.event.pull_request.title, 'fix(')
29+
uses: actions-ecosystem/action-add-labels@v1
30+
with:
31+
labels: fix
32+
33+
- name: add label based on title - feat
34+
if: |
35+
startsWith(github.event.pull_request.title, 'feat:') ||
36+
startsWith(github.event.pull_request.title, 'feat(')
37+
uses: actions-ecosystem/action-add-labels@v1
38+
with:
39+
labels: feat
40+
41+
- uses: mheap/github-action-required-labels@v1
42+
with:
43+
mode: maximum
44+
count: 0
45+
labels: "wip, work in progress, work-in-progress"
46+
47+
- uses: mheap/github-action-required-labels@v1
48+
if: |
49+
startsWith(github.event.pull_request.title, 'fix:') ||
50+
startsWith(github.event.pull_request.title, 'fix(') ||
51+
startsWith(github.event.pull_request.title, 'feat:') ||
52+
startsWith(github.event.pull_request.title, 'feat(')
53+
with:
54+
mode: minimum
55+
count: 1
56+
labels: "feature flagged, release notes"

0 commit comments

Comments
 (0)