-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (32 loc) · 1.03 KB
/
pr-validation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: PR Validation
on:
pull_request:
paths:
- 'charts/**'
jobs:
lint-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Identify Changed Charts
id: changed_charts
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_CHARTS=$(git diff --name-only origin/${{ github.base_ref }} --diff-filter=ACDMRT | grep '^charts/' | awk -F/ '{print $2}' | uniq | tr '\n' ' ')
echo "Changed charts detected: $CHANGED_CHARTS"
echo "CHANGED_CHARTS=$CHANGED_CHARTS" >> $GITHUB_ENV
- name: Lint Changed Charts
if: env.CHANGED_CHARTS != ''
run: |
for chart in $CHANGED_CHARTS; do
CHART_PATH="charts/$chart"
if [ -d "$CHART_PATH" ]; then
echo "Linting $chart..."
helm lint $CHART_PATH
fi
done