Skip to content

Apache Lucene open-source search software

Generate executive report.

Dawid Weiss5b259ce0633b
diff --git a/.github/workflows/activity-report.sh b/.github/workflows/activity-report.sh
new file mode 100644
index 00000000000..37faae32e9f
--- /dev/null
+++ b/.github/workflows/activity-report.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# script inputs, with some defaults.
+# date format examples:
+# - now
+# - 3 months ago
+# - yyyy-mm-dd
+
+: "${SINCE:?The SINCE env variable is required (now, 3 months ago, yyyy-mm-dd)}"
+: "${UNTIL:=now}"
+: "${REPO:=apache/lucene}"
+
+# compute yyyy-mm-dd formats
+SINCE_TS=$(date -u -d "$SINCE" +"%Y-%m-%d")
+UNTIL_TS=$(date -u -d "$UNTIL" +"%Y-%m-%d")
+
+# https://cli.github.com/manual/gh_help_environment
+export GH_FORCE_TTY=160
+
+echo "# Repository Activity Report ($REPO)"
+echo "Date range covered by this report: $SINCE_TS .. $UNTIL_TS"
+
+echo "## Commits and issue summary:"
+echo -n "* The number of commits to the main branch: "
+git log main --pretty='format:%h,%as,%an,%s' --since="$SINCE" --before="$UNTIL" | wc -l
+
+echo -n "* The number of commits to any branch: "
+git log --all --pretty='format:%h,%as,%an,%s' --since="$SINCE" --before="$UNTIL" | wc -l
+
+echo -n "* The number of issues filed: "
+gh issue list --state all --search "created:$SINCE_TS..$UNTIL_TS" --repo $REPO --limit 1000 --json id | jq length
+
+echo -n "* The number of closed issues out of those filed: "
+gh issue list --state all --search "created:$SINCE_TS..$UNTIL_TS is:closed" --repo $REPO --limit 1000 --json id | jq length
+
+echo -n "* The number of pull requests: "
+gh pr list --state all --search "created:$SINCE_TS..$UNTIL_TS" --repo $REPO --limit 1000 --json id | jq length
+
+echo -n "* The number of closed pull requests out of those filed: "
+gh pr list --state all --search "created:$SINCE_TS..$UNTIL_TS is:closed" --repo $REPO --limit 1000 --json id | jq length
+
+echo
+echo "## Top contributors in the given time period (all commits, any branch)"
+echo '```'
+git log --all --pretty='format:%an' --since="$SINCE" --before="$UNTIL" | sort | uniq -c | sort -r -n
+echo '```'
+
+echo
+echo "## All pull requests:"
+echo '```'
+gh pr list --state all --search "created:$SINCE_TS..$UNTIL_TS" --repo $REPO --limit 1000 \
+ --json number,author,title,createdAt,state \
+ --template '{{range .}}{{tablerow (printf "#%v" .number ) .state .title .author.name (timeago .createdAt)}}{{end}}'
+echo '```'
+
+echo
+echo "## All issues:"
+echo '```'
+gh issue list --state all --search "created:$SINCE_TS..$UNTIL_TS" --repo $REPO --limit 1000 \
+ --json number,author,title,createdAt,state \
+ --template '{{range .}}{{tablerow (printf "#%v" .number ) .state .title .author.name (timeago .createdAt)}}{{end}}'
+echo '```'
+
+echo
+echo "## All commits to the main branch, including hash, author, commit title (one-liners):"
+echo '```'
+git log main --pretty='format:%h %as %<(20)%an %s' --since="$SINCE_TS" --before="$UNTIL_TS"
+echo
+echo '```'
diff --git a/.github/workflows/activity-report.yml b/.github/workflows/activity-report.yml
new file mode 100644
index 00000000000..c0faf48cd43
--- /dev/null
+++ b/.github/workflows/activity-report.yml
@@ -0,0 +1,32 @@
+name: "Generate project activity report"
+
+on:
+ workflow_dispatch:
+ inputs:
+ since:
+ description: "Since date (x months ago, yyyy-mm-dd)"
+ type: string
+ required: true
+ default: "3 months ago"
+
+ until:
+ description: "Until date (now, x months ago, yyyy-mm-dd)"
+ type: string
+ required: true
+ default: "now"
+
+jobs:
+ generate:
+ timeout-minutes: 15
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: generate report
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ SINCE="${{ inputs.since }}" UNTIL="${{ inputs.until }}" bash ./.github/workflows/activity-report.sh >> $GITHUB_STEP_SUMMARY