From 6c5029a2442f43d373f2bc758b6f27f9f5271b80 Mon Sep 17 00:00:00 2001 From: Din Music Date: Mon, 16 Sep 2024 14:58:39 +0000 Subject: [PATCH] news: Add scripts for generating weekly news Signed-off-by: Din Music --- news/README.md | 10 ++++++++ news/github-issues.py | 31 ++++++++++++++++++++++ news/weekly-changes.sh | 58 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 news/README.md create mode 100755 news/github-issues.py create mode 100755 news/weekly-changes.sh diff --git a/news/README.md b/news/README.md new file mode 100644 index 00000000..d84b8428 --- /dev/null +++ b/news/README.md @@ -0,0 +1,10 @@ +# LXD Weekly News + +Scripts to generate a list of contributions for LXD weekly news within a specified time frame. + +## Usage + +To generate a weekly news template, replace `` and `` with dates in the `YYYY-MM-DD` format, then run the command: +```sh +weekly-changes.sh +``` diff --git a/news/github-issues.py b/news/github-issues.py new file mode 100755 index 00000000..44bc4415 --- /dev/null +++ b/news/github-issues.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +import json +import sys +from urllib.parse import quote +from urllib.request import urlopen + +# Convenience functions +def get_json(url): + return json.loads(urlopen(url).read().decode()) + +# Basic arg parsing +if len(sys.argv) != 4: + print("Usage: %s ", sys.argv[0]) + sys.exit(1) + +repo = sys.argv[1] +start = sys.argv[2] +end = sys.argv[3] + +# Get data + +url = "https://api.github.com/search/issues?q=repo:%s+is:merged+is:pr+merged:%s..%s&per_page=100&sort=created&order=asc" % (repo, start, end) + +prs = get_json(url) + +if len(prs["items"]) <= 0: + print("* Nothing to report this week") + +for pr in prs["items"]: + print(" - [%s](%s)" % (pr["title"], pr["html_url"])) diff --git a/news/weekly-changes.sh b/news/weekly-changes.sh new file mode 100755 index 00000000..62c629bb --- /dev/null +++ b/news/weekly-changes.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e + +# Always from Monday to Sunday. +DATESTART=$1 # YYYY-MM-DD +DATEEND=$2 # YYYY-MM-DD + +if [ "${DATESTART}" = "" ] || [ "${DATEEND}" = "" ]; then + echo "Usage: $0 " + exit 1 +fi + +# +# Template that needs to be populated. +# +echo '**Weekly status for the week of
th to
th .**' + +echo -e "\n# Introduction" +echo -e "\nA few sentences summarizing this week." + +echo -e "\n## Feature 1" +echo -e "What it is? How to use it? Link to the docs" +echo -e "Documentation: LINK" + +echo -e "\n## Feature 2" +echo -e "What it is? How to use it? Link to the docs" +echo -e "Documentation: LINK" + +echo -e "\n## Bugfixes" +echo "- Fixed ..." +echo "- Fixed ..." + +# +# Generated, leave as is. +# +echo -e "\n## All changes" +echo -e "\nThe items listed below is all of the work which happened over the past week and which will be included in the next release." + +echo -e "\n## LXD" +./github-issues.py canonical/lxd "${1}" "${2}" +sleep 1 + +echo -e "\n## LXD UI" +./github-issues.py canonical/lxd-ui "${1}" "${2}" +sleep 1 + +echo -e "\n## LXD Charm" +./github-issues.py canonical/charm-lxd "${1}" "${2}" + +echo -e "\n# Distribution work" +echo -e "\nThis section is used to track the work done in downstream Linux distributions to ship the latest LXD as well as work to get various software to work properly inside containers." + +echo -e "\n## Ubuntu" +echo -e "* Nothing to report this week." + +echo -e "\n## LXD snap" +./github-issues.py canonical/lxd-pkg-snap "${1}" "${2}"