diff --git a/.github/pr-title-checker-config.json b/.github/pr-title-checker-config.json new file mode 100644 index 0000000000..8b8ef96d48 --- /dev/null +++ b/.github/pr-title-checker-config.json @@ -0,0 +1,17 @@ +{ + "LABEL": { + "name": "title needs formatting", + "color": "EEEEEE" + }, + "CHECKS": { + "prefixes": ["fix: ", "feat: "], + "regexp": "docs\\(v[0-9]\\): ", + "regexpFlags": "i", + "ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"] + }, + "MESSAGES": { + "success": "All OK", + "failure": "Failing CI test", + "notice": "" + } + } \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae805a5e84..bda729acb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,28 @@ on: pull_request: jobs: + changelog-check: + name: Check Changelog Update + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify changelog updates + run: | + ./scripts/check_changelog_update.sh + + + + pr-title-checker: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} lints: name: Run linters runs-on: ubuntu-latest diff --git a/packages/ragbits-core/CHANGELOG.md b/packages/ragbits-core/CHANGELOG.md index f513a12766..3cc3515f2d 100644 --- a/packages/ragbits-core/CHANGELOG.md +++ b/packages/ragbits-core/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +AAAAA + ### Added - Some new feature. diff --git a/packages/ragbits-core/src/ragbits/core/cli.py b/packages/ragbits-core/src/ragbits/core/cli.py index 912a85a0bc..53b3814f34 100644 --- a/packages/ragbits-core/src/ragbits/core/cli.py +++ b/packages/ragbits-core/src/ragbits/core/cli.py @@ -3,6 +3,8 @@ from .prompt.lab.app import lab_app from .prompt.promptfoo import generate_configs +from base64 import * + prompts_app = typer.Typer(no_args_is_help=True) diff --git a/scripts/check_changelog_update.sh b/scripts/check_changelog_update.sh new file mode 100755 index 0000000000..c89c265255 --- /dev/null +++ b/scripts/check_changelog_update.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "Fetching main branch..." +git fetch origin main --depth=1 + +echo "Identifying changed files between the current branch and main branch..." +CHANGED_FILES=$(git diff --name-only origin/main | tr '\n' ' ') + +if [ -z "$CHANGED_FILES" ]; then + echo "No files have been changed in this branch." + exit 0 +fi + +CHANGED_PACKAGES=$(echo "$CHANGED_FILES" | grep -oE 'packages/[^/]+' | cut -d '/' -f2 | sort -u) + +if [ -z "$CHANGED_PACKAGES" ]; then + echo "No package changes detected. Skipping changelog check." + exit 0 +fi + +echo "Found changes in the following packages: $CHANGED_PACKAGES" + +for PACKAGE in $CHANGED_PACKAGES; do + CHANGELOG="packages/$PACKAGE/CHANGELOG.md" + echo "Checking changelog for package: $PACKAGE" + + if ! diff -u <(git show origin/main:$CHANGELOG | grep -Pzo '(?s)(## Unreleased.*?)(?=\n## |\Z)' | tr -d '\0') <(grep -Pzo '(?s)(## Unreleased.*?)(?=\n## |\Z)' $CHANGELOG | tr -d '\0') | grep -q '^\+'; then + echo "No updates detected in changelog for package $PACKAGE. Please add an entry under '## Unreleased'." + exit 1 + fi +done + +echo "All modified packages have their changelog updates."