aboutsummaryrefslogtreecommitdiffstats
path: root/.circleci/scripts/show-changelog.awk
blob: e490df9db2e0f8b96f51a8d73c18d11691133dd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# DESCRIPTION
#
# This script will print out all of the CHANGELOG.md lines for a given version
# with the assumption that the CHANGELOG.md files looks something along the
# lines of:
#
# ```
# ## 6.6.2 Fri Jun 07 2019
#
# - [#6690](https://github.com/MetaMask/metamask-extension/pull/6690): Some words
# - [#6700](https://github.com/MetaMask/metamask-extension/pull/6700): some more words
#
# ## 6.6.1 Thu Jun 06 2019
#
# - [#6691](https://github.com/MetaMask/metamask-extension/pull/6691): Revert other words
#
# ## 6.6.0 Mon Jun 03 2019
#
# - [#6659](https://github.com/MetaMask/metamask-extension/pull/6659): foo
# - [#6671](https://github.com/MetaMask/metamask-extension/pull/6671): bar
# - [#6625](https://github.com/MetaMask/metamask-extension/pull/6625): baz
# - [#6633](https://github.com/MetaMask/metamask-extension/pull/6633): Many many words
#
#
# ```
#
# EXAMPLE
#
# Run this script like so, passing in the version:
#
# ```
# awk -v version='6.6.0' -f .circleci/scripts/show-changelog.awk CHANGELOG.md
# ```
#

BEGIN {
    inside_section = 0;
}

$1 == "##" && $2 == version {
    inside_section = 1;
    next;
}

$1 == "##" && $2 != version {
    inside_section = 0;
    next;
}

inside_section && !/^$/ {
    print $0;
}