Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gh-action): ensures generated files are up-to-date in PR #917

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/check-file-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Check config and readme updates
on:
pull_request:
paths:
- "apis/**"
bartoszmajsak marked this conversation as resolved.
Show resolved Hide resolved
jobs:
file-updates:
permissions:
pull-requests: write
name: Test file updates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run make commands
run: |
make generate && make manifests && make api-docs
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
- name: Check for unstaged files
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
id: check_unstaged_files
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
run : |
if [[ -n $(git status -s) ]]
then
echo "New files to commit available"
echo "is_files_to_commit_present=true" >> $GITHUB_OUTPUT
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
else
echo "No new files to commit"
echo "is_files_to_commit_present=false" >> $GITHUB_OUTPUT
fi
- name: Generate comments
if: ${{ steps.check_unstaged_files.outputs.is_files_to_commit_present == 'true' }}
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## Important Message :x:
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved

This PR cannot be merged as some files are not upto date. Please run the below commands to auto-generate files and make sure to commit them:
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
- `make generate`
- `make manifests`
- `make api-docs`
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved

For more info: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
zdtsw marked this conversation as resolved.
Show resolved Hide resolved
- name: Print git status and fail pr
if: ${{ steps.check_unstaged_files.outputs.is_files_to_commit_present == 'true' }}
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
run: |
git status
exit 1
AjayJagan marked this conversation as resolved.
Show resolved Hide resolved
Loading