|
| 1 | +name: Validate Version and Changelog |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + validate-version: |
| 10 | + name: Validate version updates |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v6 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: Get changed files |
| 18 | + id: changes |
| 19 | + run: | |
| 20 | + git diff origin/main...HEAD --name-only > changes.txt |
| 21 | + echo "Changed files:" |
| 22 | + cat changes.txt |
| 23 | +
|
| 24 | + - name: Validate version updates for changed packages |
| 25 | + run: | |
| 26 | + VALIDATION_FAILED=0 |
| 27 | +
|
| 28 | + # Core package: src/uipath_llm_client/ -> src/uipath_llm_client/__version__.py |
| 29 | + core_changes=$(grep -E '^src/uipath_llm_client/' changes.txt | grep -v '__version__.py' || true) |
| 30 | + core_version=$(grep -E '^src/uipath_llm_client/__version__.py' changes.txt || true) |
| 31 | + if [ -n "$core_changes" ] && [ -z "$core_version" ]; then |
| 32 | + echo "::error::Core package (src/uipath_llm_client/) changes detected but no version update in src/uipath_llm_client/__version__.py" |
| 33 | + VALIDATION_FAILED=1 |
| 34 | + fi |
| 35 | +
|
| 36 | + # Langchain package: packages/uipath_langchain_client/ -> packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py |
| 37 | + langchain_changes=$(grep -E '^packages/uipath_langchain_client/' changes.txt | grep -v '__version__.py' || true) |
| 38 | + langchain_version=$(grep -E '^packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py' changes.txt || true) |
| 39 | + if [ -n "$langchain_changes" ] && [ -z "$langchain_version" ]; then |
| 40 | + echo "::error::Langchain package (packages/uipath_langchain_client/) changes detected but no version update in packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py" |
| 41 | + VALIDATION_FAILED=1 |
| 42 | + fi |
| 43 | +
|
| 44 | + # LlamaIndex package: packages/uipath_llamaindex_client/ -> packages/uipath_llamaindex_client/src/uipath_llamaindex_client/__version__.py |
| 45 | + llamaindex_changes=$(grep -E '^packages/uipath_llamaindex_client/' changes.txt | grep -v '__version__.py' || true) |
| 46 | + llamaindex_version=$(grep -E '^packages/uipath_llamaindex_client/src/uipath_llamaindex_client/__version__.py' changes.txt || true) |
| 47 | + if [ -n "$llamaindex_changes" ] && [ -z "$llamaindex_version" ]; then |
| 48 | + echo "::error::LlamaIndex package (packages/uipath_llamaindex_client/) changes detected but no version update in packages/uipath_llamaindex_client/src/uipath_llamaindex_client/__version__.py" |
| 49 | + VALIDATION_FAILED=1 |
| 50 | + fi |
| 51 | +
|
| 52 | + if [ $VALIDATION_FAILED -eq 1 ]; then |
| 53 | + exit 1 |
| 54 | + fi |
| 55 | + echo "✓ All package versions are consistent with changes." |
| 56 | +
|
| 57 | + - name: Validate changelog updates for version changes |
| 58 | + run: | |
| 59 | + VALIDATION_FAILED=0 |
| 60 | +
|
| 61 | + # Core package: src/uipath_llm_client/__version__.py -> CHANGELOG.md (root) |
| 62 | + core_version=$(grep -E '^src/uipath_llm_client/__version__.py' changes.txt || true) |
| 63 | + core_changelog=$(grep -E '^CHANGELOG.md' changes.txt || true) |
| 64 | + if [ -n "$core_version" ] && [ -z "$core_changelog" ]; then |
| 65 | + echo "::error::Core package version changed but no changelog update in CHANGELOG.md" |
| 66 | + VALIDATION_FAILED=1 |
| 67 | + fi |
| 68 | +
|
| 69 | + # Langchain package: packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py -> packages/uipath_langchain_client/CHANGELOG.md |
| 70 | + langchain_version=$(grep -E '^packages/uipath_langchain_client/src/uipath_langchain_client/__version__.py' changes.txt || true) |
| 71 | + langchain_changelog=$(grep -E '^packages/uipath_langchain_client/CHANGELOG.md' changes.txt || true) |
| 72 | + if [ -n "$langchain_version" ] && [ -z "$langchain_changelog" ]; then |
| 73 | + echo "::error::Langchain package version changed but no changelog update in packages/uipath_langchain_client/CHANGELOG.md" |
| 74 | + VALIDATION_FAILED=1 |
| 75 | + fi |
| 76 | +
|
| 77 | + # LlamaIndex package: packages/uipath_llamaindex_client/src/uipath_llamaindex_client/__version__.py -> packages/uipath_llamaindex_client/CHANGELOG.md |
| 78 | + llamaindex_version=$(grep -E '^packages/uipath_llamaindex_client/src/uipath_llamaindex_client/__version__.py' changes.txt || true) |
| 79 | + llamaindex_changelog=$(grep -E '^packages/uipath_llamaindex_client/CHANGELOG.md' changes.txt || true) |
| 80 | + if [ -n "$llamaindex_version" ] && [ -z "$llamaindex_changelog" ]; then |
| 81 | + echo "::error::LlamaIndex package version changed but no changelog update in packages/uipath_llamaindex_client/CHANGELOG.md" |
| 82 | + VALIDATION_FAILED=1 |
| 83 | + fi |
| 84 | +
|
| 85 | + if [ $VALIDATION_FAILED -eq 1 ]; then |
| 86 | + exit 1 |
| 87 | + fi |
| 88 | + echo "✓ All changelogs are consistent with version changes." |
0 commit comments