File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ name: Generate code and open pull request
22
33on :
44 workflow_dispatch :
5+ pull_request :
56 push :
67 branches :
78 - master
2728 diff=$(git --no-pager diff --name-only HEAD)
2829 echo "DIFF_IS_EMPTY=$([[ -z "$diff" ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
2930 echo "CURRENT_DATETIME=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
30- - if : ${{ env.DIFF_IS_EMPTY != 'true' }}
31+ # # Run if diff exists and pull request, and make CI status failure
32+ - if : ${{ github.event_name == 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
33+ run : |
34+ echo "There are changes in the generated codes. Please run 'generate-code.py' and commit the changes." >&2
35+ exit 1
36+ # # Run if diff exists and event is not pull request, and make PR
37+ - if : ${{ github.event_name != 'pull_request' && env.DIFF_IS_EMPTY != 'true' }}
3138 run : |
3239 git config user.name github-actions
3340 git config user.email [email protected]
You can’t perform that action at this time.
0 commit comments