commit 08d7ef30229ae51ec8fe1931f5161c7025f8d0c9
parent bed149a8745d033d003e2f5e51734b1920dbba5e
Author: Arjoonn Sharma <arjoonn@midpathsoftware.com>
Date: Sat, 28 Feb 2026 13:21:34 +0530
x
Diffstat:
2 files changed, 80 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
@@ -4,13 +4,28 @@
---
-1. [Install](#install)
-2. [Config](#config)
-3. [Environment Vars](#environment-vars)
-4. [Example Workflow](#example-workflow)
-5. [How it works](#how-it-works)
-6. [FAQ / Needs / Wants / Todos](#faq-needs-wants-todos)
-7. [Examples](#examples)
+- [Install](#install)
+- [Config](#config)
+- [Environment Vars](#environment-vars)
+- [Example workflow](#example-workflow)
+- [How it works](#how-it-works)
+- [FAQ / Needs / Wants / Todos](#faq-needs-wants-todos)
+- [Examples](#examples)
+ - [Lint, Build, Test, Publish a golang project](#lint-build-test-publish-a-golang-project)
+ - [Pylint, Pytest, Coverage report](#pylint-pytest-coverage-report)
+ - [Build Jekyll and publish to netlify](#build-jekyll-and-publish-to-netlify)
+ - [Build Docusaurus and publish to S3 bucket](#build-docusaurus-and-publish-to-s3-bucket)
+ - [Run a docker compose of redis, postgres, django, and run API tests against it.](#run-a-docker-compose-of-redis-postgres-django-and-run-api-tests-against-it)
+ - [Schedule a midnight build and push status to telegram](#schedule-a-midnight-build-and-push-status-to-telegram)
+ - [Run trufflehog scan on repo every hour](#run-trufflehog-scan-on-repo-every-hour)
+ - [Run lint --fix on pre-commit for python, go, JS in the same repo](#run-lint-fix-on-pre-commit-for-python-go-js-in-the-same-repo)
+ - [Create sub-pipelines for python / js / go and run when changes are there in any folder](#create-sub-pipelines-for-python-js-go-and-run-when-changes-are-there-in-any-folder)
+ - [Set and use Secrets to publish messages to telegram](#set-and-use-secrets-to-publish-messages-to-telegram)
+ - [Send mail on scheduled pipe failures](#send-mail-on-scheduled-pipe-failures)
+ - [Midnight auto-update dependencies and ensure tests are passing after update](#midnight-auto-update-dependencies-and-ensure-tests-are-passing-after-update)
+ - [Build and publish docker images](#build-and-publish-docker-images)
+ - [Run pipelines on this repo, when changes happen in upstream projects](#run-pipelines-on-this-repo-when-changes-happen-in-upstream-projects)
+ - [Run pipelines on another repo, when changes affect downstream projects](#run-pipelines-on-another-repo-when-changes-affect-downstream-projects)
---
diff --git a/scripts/generate_readme_index.sh b/scripts/generate_readme_index.sh
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+README_FILE="${1:-README.md}"
+
+if [[ ! -f "${README_FILE}" ]]; then
+ echo "README file not found: ${README_FILE}" >&2
+ exit 1
+fi
+
+python3 - "$README_FILE" <<'PY'
+import sys
+import re
+from pathlib import Path
+
+readme_path = Path(sys.argv[1])
+text = readme_path.read_text(encoding="utf-8")
+
+lines = text.splitlines()
+dash_lines = [idx for idx, line in enumerate(lines) if line.strip() == '---']
+if len(dash_lines) < 2:
+ raise SystemExit("Expected at least two lines containing only '---' in README")
+
+heading_pattern = re.compile(r'^(#{2,3})\s+(.*)$', re.MULTILINE)
+headings = []
+for match in heading_pattern.finditer(text):
+ level = len(match.group(1))
+ title = match.group(2).strip()
+ if not title:
+ continue
+ slug = title.lower()
+ slug = re.sub(r'[^a-z0-9\s-]', '', slug)
+ slug = re.sub(r'\s+', '-', slug).strip('-')
+ slug = re.sub(r'-+', '-', slug)
+ if not slug:
+ continue
+ headings.append((level, title, f"#{slug}"))
+
+index_lines = []
+for level, title, anchor in headings:
+ indent = '' if level == 2 else ' '
+ index_lines.append(f"{indent}- [{title}]({anchor})")
+
+first, second = dash_lines[:2]
+result_lines = []
+result_lines.extend(lines[:first + 1])
+result_lines.append('')
+if index_lines:
+ result_lines.extend(index_lines)
+result_lines.append('')
+result_lines.extend(lines[second:])
+
+new_text = "\n".join(result_lines)
+if not new_text.endswith("\n"):
+ new_text += "\n"
+
+readme_path.write_text(new_text, encoding="utf-8")
+PY