Skip to content

Commit d152a14

Browse files
committed
verify-chart-version: always run + no-op when chart untouched
verify-version is a required status check (branch ruleset on main). With the paths: charts/s3proxy/** filter, PRs that don't touch the chart skipped the job, so the required check never reported and the PR stayed BLOCKED. Drop the path filter and gate the real steps on a git-diff change-detector, so the check always runs and passes as a no-op when the chart is not modified.
1 parent afaa319 commit d152a14

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

.github/workflows/verify-chart-version.yaml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ on:
55
pull_request:
66
branches:
77
- main
8-
paths:
9-
- charts/s3proxy/**
8+
# No `paths:` filter on purpose. `verify-version` is a REQUIRED status check
9+
# (branch ruleset on main). With a path filter, PRs that don't touch
10+
# charts/s3proxy/** would skip this job, the required check would never be
11+
# reported, and the PR would be blocked forever ("Expected — waiting for
12+
# status"). Instead the job always runs and no-ops (passes) when the chart is
13+
# not modified — see the "Detect chart changes" step below.
1014

1115
jobs:
1216
verify-version:
@@ -22,15 +26,30 @@ jobs:
2226
fetch-depth: 0
2327
fetch-tags: true
2428

29+
- name: Detect chart changes
30+
id: changes
31+
run: |
32+
# cwd is ./charts/s3proxy (job default), so `-- .` scopes the diff to the chart.
33+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" HEAD -- . | grep -q .
34+
then
35+
echo "changed=true" >> "$GITHUB_OUTPUT"
36+
echo "Chart files changed — running version check."
37+
else
38+
echo "changed=false" >> "$GITHUB_OUTPUT"
39+
echo "No changes under charts/s3proxy/** — version check is a no-op for this PR."
40+
fi
41+
2542
- name: Get current chart version
2643
id: current_version
44+
if: steps.changes.outputs.changed == 'true'
2745
run: |
2846
CURRENT_VERSION=$(yq '.version' Chart.yaml)
2947
echo "Current Chart version: $CURRENT_VERSION"
3048
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
3149
3250
- name: Get latest release version
3351
id: latest_release
52+
if: steps.changes.outputs.changed == 'true'
3453
env:
3554
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3655
run: |
@@ -76,13 +95,13 @@ jobs:
7695
git checkout HEAD -- Chart.yaml
7796
7897
- name: Install semver comparison tool
79-
if: steps.latest_release.outputs.has_release == 'true'
98+
if: steps.changes.outputs.changed == 'true' && steps.latest_release.outputs.has_release == 'true'
8099
run: |
81100
# Install Node.js semver tool for accurate version comparison
82101
npm install -g semver
83102
84103
- name: Compare versions
85-
if: steps.latest_release.outputs.has_release == 'true'
104+
if: steps.changes.outputs.changed == 'true' && steps.latest_release.outputs.has_release == 'true'
86105
run: |
87106
CURRENT_VERSION="${{ steps.current_version.outputs.version }}"
88107
RELEASE_VERSION="${{ steps.latest_release.outputs.version }}"
@@ -125,7 +144,12 @@ jobs:
125144
if: always()
126145
run: |
127146
# Write to GitHub workflow summary
128-
if [ "${{ steps.latest_release.outputs.has_release }}" != "true" ]
147+
if [ "${{ steps.changes.outputs.changed }}" != "true" ]
148+
then
149+
echo "## 📋 Chart Version Check Summary" >> $GITHUB_STEP_SUMMARY
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
echo "✅ **Status:** No changes under \`charts/s3proxy/**\` — version check not required for this PR." >> $GITHUB_STEP_SUMMARY
152+
elif [ "${{ steps.latest_release.outputs.has_release }}" != "true" ]
129153
then
130154
echo "## 📋 Chart Version Check Summary" >> $GITHUB_STEP_SUMMARY
131155
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)