forked from opendatahub-io/opendatahub-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.63 KB
/
check-file-updates.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Check config and readme updates
on:
pull_request_target:
jobs:
file-updates:
permissions:
pull-requests: write
name: Ensure generated files are included
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Generate files
id: generate-files
run: |
CMD="make generate manifests api-docs"
$CMD
echo "CMD=$CMD" >> $GITHUB_OUTPUT
- name: Ensure generated files are up-to-date
id: check_generated_files
run : |
if [[ -n $(git status -s) ]]
then
echo "Generated files have been missed in the PR"
git diff
echo "missing_generated_files=true" >> $GITHUB_OUTPUT
else
echo "No new files to commit"
echo "missing_generated_files=false" >> $GITHUB_OUTPUT
fi
- name: Report issue in PR
if: ${{ steps.check_generated_files.outputs.missing_generated_files == 'true' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## This PR can't be merged just yet 😢
Please run `${{ steps.generate-files.outputs.CMD }}` and commit the changes.
For more info: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Print git status and fail pr
if: ${{ steps.check_generated_files.outputs.missing_generated_files == 'true' }}
run: |
git status
exit 1