Skip to content

Commit

Permalink
workflows: fix validate CRD by fetching all git repo history
Browse files Browse the repository at this point in the history
Also add a trigger on the workflow file to test.

Signed-off-by: Mahe Tardy <[email protected]>
  • Loading branch information
mtardy committed Feb 5, 2024
1 parent 02762ad commit 6150c28
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/validate-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ on:
paths:
- 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml'
- 'pkg/k8s/apis/cilium.io/v1alpha1/version.go'
- '.github/workflows/validate-crd.yaml'

jobs:
check-version:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Check for CRD changes and version update
run: |
crd_changed=0
version_changed=0
# Check for CRD changes
crd_changes=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} -- pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml)
crd_changes=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} -- pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml)
if [ -n "$crd_changes" ]; then
crd_changed=1
fi
Expand All @@ -44,4 +47,4 @@ jobs:
if [ "$crd_changed" -eq 0 ] && [ "$version_changed" -eq 1 ]; then
echo "CustomResourceDefinitionSchemaVersion in pkg/k8s/apis/cilium.io/v1alpha1/version.go to be updated only in case of modifying the files pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml"
exit 1
fi
fi

0 comments on commit 6150c28

Please sign in to comment.