Skip to content

Feature/#1492 api changes GitHub actions #35

Feature/#1492 api changes GitHub actions

Feature/#1492 api changes GitHub actions #35

name: "Check for changes in Controller APIs"
on:
pull_request:
branches: [ "api-changes-pipeline-test" ]
types:
- "opened"
- "reopened"
- "synchronize"
- "labeled"
- "unlabeled"
jobs:
check-api-diff:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'confirm/api-changes') }}
name: Check API diff
runs-on: ubuntu-latest
steps:
- name: Checkout PR ref of lifecycle-manager
uses: actions/checkout@v4
- name: Copy PR CRDs to temp dir
run: mkdir -p /tmp/pr-crds && cp ./config/crd/bases/* /tmp/pr-crds/
- name: Checkout main of lifecycle-manager
uses: actions/checkout@v4
with:
ref: main
- name: Copy main CRDs to temp dir
run: mkdir -p /tmp/main-branch-crds && cp ./config/crd/bases/* /tmp/main-branch-crds/
- name: Compare CRD files
working-directory: /tmp
run: |
pr_files=$(ls ./pr-crds)
main_files=$(ls ./main-branch-crds)
if [[ "$pr_files" != "$main_files" ]]; then
echo "CRD files do not match"
echo "Differences between pr-crds and main-branch-crds:"
diff -r pr-crds main-branch-crds || true
exit 1
fi
echo "CRD files match"