From c67dd8d86781b9881b5bf74b9edf2dc779809300 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Mon, 23 Dec 2024 10:21:16 -0800 Subject: [PATCH] [BLD]: add workflow that warns if the Helm chart was modified without bumping the version (#3350) --- .github/workflows/pr.yml | 63 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 93cdca3d939..84054cf66c6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,7 +13,8 @@ jobs: runs-on: ubuntu-latest outputs: outside-docs: ${{ steps.changes.outputs.outside-docs }} - docs: ${{ steps.changes.outputs.docs }} + only-docs: ${{ steps.changes.outputs.docs }} + helm-changes: ${{ steps.helm-changes.outputs.helm-changes }} steps: - name: Get changed paths id: changes @@ -25,11 +26,18 @@ jobs: - '!docs/**' docs: - 'docs/**' + - name: Check for Helm changes + id: helm-changes + uses: dorny/paths-filter@v3 + with: + filters: | + helm-changes: + - 'k8s/distributed-chroma/**' deploy-docs-preview: name: Deploy preview of docs needs: paths-filter - if: needs.paths-filter.outputs.docs == 'true' + if: needs.paths-filter.outputs.only-docs == 'true' runs-on: depot-ubuntu-22.04-small environment: name: Preview @@ -52,6 +60,57 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }} + check-helm-version-bump: + name: Warn if Helm chart was updated without version bump + needs: paths-filter + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + - name: Detect if version field in Chart.yaml was changed + id: detect-version-change + shell: bash + run: | + current=$(git show HEAD:$file | yq ".version") + previous=$(git show HEAD^:$file | yq ".version") + + echo "version=$current" >> $GITHUB_OUTPUT + + if [ "$current" != "$previous" ]; then + echo "Version field in $file was changed from $previous to $current" + echo "version_changed=true" >> $GITHUB_OUTPUT + else + echo "Version field in $file was not changed" + echo "version_changed=false" >> $GITHUB_OUTPUT + fi + env: + file: k8s/distributed-chroma/Chart.yaml + + - name: Comment warning + if: ${{ steps.detect-version-change.outputs.version_changed == 'false' && needs.paths-filter.outputs.helm-changes == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: helm-chart-version-info + message: | + :warning: The Helm chart was updated without a version bump. Your changes will only be published if the version field in `k8s/distributed-chroma/Chart.yaml` is updated. + + - name: Comment success + if: ${{ steps.detect-version-change.outputs.version_changed == 'true' && needs.paths-filter.outputs.helm-changes == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: helm-chart-version-info + message: | + :white_check_mark: The Helm chart's version was changed. Your changes to the chart will be published upon merge to `main`. + + - name: Delete comment (Helm chart was not changed) + if: needs.paths-filter.outputs.helm-changes == 'false' + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: helm-chart-version-info + delete: true python-tests: name: Python tests