From d9534d8d2ccc937aeff36df3b2c7cf411b4b7e15 Mon Sep 17 00:00:00 2001
From: Fabrice Reix <fabrice.reix@orange.com>
Date: Wed, 2 Nov 2022 19:01:49 +0100
Subject: [PATCH] Update/Check CHANGELOG

---
 .github/workflows/check.yml      |  2 ++
 CHANGELOG.md                     | 31 +++++++++++++++++++++++++++++++
 bin/check/changelog.sh           | 16 ++++++++++++++++
 bin/release/changelog_extract.py | 29 +++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+)
 create mode 100755 bin/check/changelog.sh
 create mode 100755 bin/release/changelog_extract.py

diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 82ee2da1e..101626f69 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -25,5 +25,7 @@ jobs:
       run: bin/check/xmllint.sh
     - name: Run crates update
       run: bin/check/crates.sh 
+    - name: Check CHANGELOG
+      run: bin/check/changelog.sh 
     - name: Check ad hoc
       run: bin/check/ad_hoc.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9047863ff..a0bb1207e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,34 @@
+[1.8.0 (2022-11-02)](https://github.com/Orange-OpenSource/hurl/blob/master/CHANGELOG.md#1.8.0)
+========================================================================================================================
+
+Thanks to
+[@Jiehong](https://github.com/Jiehong),
+[@Goffen](https://github.com/Goffen),
+
+
+Enhancements:
+
+ * Add curl logs [#899](https://github.com/Orange-OpenSource/hurl/issues/899)
+
+ * Add query url [#895](https://github.com/Orange-OpenSource/hurl/issues/895)
+
+ * Make compact help [#861](https://github.com/Orange-OpenSource/hurl/issues/861)
+
+ * List all libcurl features with --version [#836](https://github.com/Orange-OpenSource/hurl/issues/836)
+
+ * Add --retry and --retry-interval option to retry request until asserts and captures are ok [#525](https://github.com/Orange-OpenSource/hurl/issues/525)
+
+
+Bugs Fixed:
+
+ * Fix missing line in HTML output [#924](https://github.com/Orange-OpenSource/hurl/issues/924)
+
+ * Fix HTTP HEAD [#903](https://github.com/Orange-OpenSource/hurl/issues/903)
+
+ * Fix relative redirect [#875](https://github.com/Orange-OpenSource/hurl/issues/875)
+
+
+
 [1.7.0 (2022-09-13)](https://github.com/Orange-OpenSource/hurl/blob/master/CHANGELOG.md#1.7.0)
 ========================================================================================================================
 
diff --git a/bin/check/changelog.sh b/bin/check/changelog.sh
new file mode 100755
index 000000000..e78d30bcc
--- /dev/null
+++ b/bin/check/changelog.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Check that issues in CHANGELOG are up-to-to-date
+set -eu
+
+version=$(head -1 <CHANGELOG.md| cut -d" " -f1 | cut -d'[' -f2)
+changelog=$(bin/release/changelog_extract.py "$version" <CHANGELOG.md| grep '^ \* ')
+issues=$(bin/release/get_release_note.py "$version" 2>/dev/null | grep '^ \* ')
+
+if [ "$changelog" != "$issues" ];  then
+    echo "Diff in issues in CHANGELOG"
+    diff <(echo "$changelog") <(echo "$issues")
+    exit 1
+fi
+
+
+
diff --git a/bin/release/changelog_extract.py b/bin/release/changelog_extract.py
new file mode 100755
index 000000000..a0a94ab65
--- /dev/null
+++ b/bin/release/changelog_extract.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+# cat CHANGELOG.md | bin/release/changelog_extract.py 1.8.0
+import sys
+
+
+def extract(version):
+    print_line = False
+    for line in sys.stdin.readlines():
+        if "CHANGELOG" in line and line.startswith("["):
+            if line[1:].startswith(version):
+                print_line = True
+            else:
+                print_line = False
+        if print_line:
+            print(line.rstrip())
+
+
+def main():
+    if len(sys.argv) < 2:
+        print("usage:")
+        print("  cat CHANGELOG.md | bin/release/changelog_extract.py 1.8.0")
+        sys.exit(1)
+
+    version = sys.argv[1]
+    extract(version)
+
+
+if __name__ == "__main__":
+    main()