Skip to content

Commit

Permalink
news: Add scripts for generating weekly news (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Sep 16, 2024
2 parents a99f3d2 + 6c5029a commit 24890a7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
10 changes: 10 additions & 0 deletions news/README.md
Original file line number Diff line number Diff line change
@@ -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 `<from_date>` and `<to_date>` with dates in the `YYYY-MM-DD` format, then run the command:
```sh
weekly-changes.sh <from_date> <to_date>
```
31 changes: 31 additions & 0 deletions news/github-issues.py
Original file line number Diff line number Diff line change
@@ -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 <repo> <date_start> <date_end>", 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"]))
58 changes: 58 additions & 0 deletions news/weekly-changes.sh
Original file line number Diff line number Diff line change
@@ -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 <date_start> <date_end>"
exit 1
fi

#
# Template that needs to be populated.
#
echo '**Weekly status for the week of <DD>th <MM> to <DD>th <MM>.**'

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}"

0 comments on commit 24890a7

Please sign in to comment.