-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
150 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "Check if Manifests are Up-to-Date" | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
check-manifests-changes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 # Needed for diff comparison | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y make | ||
- name: Generate KLM Manifests from PR | ||
run: make manifests | ||
|
||
- name: Compare Generated Manifests with `main` | ||
id: check-manifests | ||
run: | | ||
git diff --exit-code config/ || echo "outdated_manifests=true" >> $GITHUB_ENV | ||
continue-on-error: true | ||
|
||
- name: Fail if Manifests Are Outdated | ||
if: env.outdated_manifests == 'true' | ||
run: | | ||
echo "❌ Manifests are outdated! Run 'make manifests' and commit changes." | ||
exit 1 | ||
- name: Add PR Comment if Manifests Are Outdated | ||
if: failure() && env.outdated_manifests == 'true' | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.payload.pull_request.number, | ||
body: "❌ **Manifests are outdated!** Please run `make manifests` and commit the changes." | ||
}); | ||
github.rest.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.payload.pull_request.number, | ||
labels: ["outdated-manifests"] | ||
}); |