Skip to content

sync-crds

sync-crds #14829

Workflow file for this run

name: sync-crds
on:
push:
branches:
- alpha
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
sync-crds:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- uses: azure/setup-helm@v3
with:
version: 'latest'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Remove Models from Solution
run: dotnet sln remove ./src/Models/**/*.csproj
- name: Clean Models
run: rm -rf ./src/Models/KubernetesCRDModelGen*
- name: Sync CRDs
run: dotnet run --project ./src/KubernetesCRDModelGen.Sync/KubernetesCRDModelGen.Sync.csproj --ModelDir ../Models
- name: Add Models to Solution
run: dotnet sln add ./src/Models/**/*.csproj
- name: Check Files Changed
id: checkfiles
shell: pwsh
run: |
git add .
$createPR = (git diff --cached --numstat | Measure-Object -Line).Lines -gt 1;
echo "createpr=$createPR" >> $env:GITHUB_OUTPUT
- name: Create Pull Request
if: steps.checkfiles.outputs.createpr == 'True'
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GHPAT }}
branch: sync-charts
commit-message: "feat: Update CRDs"
title: "feat: Update CRDs"
body: "Automated CRD Sync"
- name: Enable Pull Request Automerge
if: steps.checkfiles.outputs.createpr == 'True'
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.GHPAT }}