update: add status update on component CR's phase #1840
Workflow file for this run
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
name: Check config and readme updates | |
on: | |
pull_request: | |
jobs: | |
file-updates: | |
permissions: | |
pull-requests: write | |
name: Ensure generated files are included | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 |