Skip to content

Commit

Permalink
[BLD]: add workflow that warns if the Helm chart was modified withou…
Browse files Browse the repository at this point in the history
…t bumping the version (#3350)
codetheweb authored Dec 23, 2024

Verified

This commit was signed with the committer’s verified signature.
sBouzols Sylvain Bouzols
1 parent 0fd6022 commit c67dd8d
Showing 1 changed file with 61 additions and 2 deletions.
63 changes: 61 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c67dd8d

Please sign in to comment.