-
Notifications
You must be signed in to change notification settings - Fork 358
ci(pr-coments): handle partial successes in pr-comments workflow #15294
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,31 +50,114 @@ jobs: | |||||||||||||||||
| # Automatically update code formatting if /format is in the comment | ||||||||||||||||||
| - name: "Auto-format code" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/format') | ||||||||||||||||||
| id: format | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| run: make clean/generated check | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: "Commit and push format changes" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/format') && steps.format.outcome == 'success' | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| env: | ||||||||||||||||||
| GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} | ||||||||||||||||||
| run: | | ||||||||||||||||||
| if git diff --exit-code --stat; then | ||||||||||||||||||
| echo "No format changes detected" | ||||||||||||||||||
| else | ||||||||||||||||||
| git config user.name "${GH_USER}" | ||||||||||||||||||
| git config user.email "${GH_EMAIL}" | ||||||||||||||||||
| git commit -s -m "fix(ci): format files" . | ||||||||||||||||||
| git push | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| # Update all golden files except transparent proxy tests if /golden_files is in the comment | ||||||||||||||||||
| - name: "Update golden files (excluding transparent proxy)" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/golden_files') | ||||||||||||||||||
| id: golden-files | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| run: make test UPDATE_GOLDEN_FILES=true | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: "Commit and push golden files changes" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/golden_files') && steps.golden-files.outcome == 'success' | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| env: | ||||||||||||||||||
| GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} | ||||||||||||||||||
| run: | | ||||||||||||||||||
| if git diff --exit-code --stat; then | ||||||||||||||||||
| echo "No golden files changes detected" | ||||||||||||||||||
| else | ||||||||||||||||||
| git config user.name "${GH_USER}" | ||||||||||||||||||
| git config user.email "${GH_EMAIL}" | ||||||||||||||||||
| git commit -s -m "fix(ci): update golden files" . | ||||||||||||||||||
| git push | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| # Update only transparent proxy golden files if /golden_files_tproxy is in the comment | ||||||||||||||||||
| - name: "Update transparent proxy golden files" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/golden_files_tproxy') | ||||||||||||||||||
| id: golden-files-tproxy | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| run: make test/transparentproxy UPDATE_GOLDEN_FILES=true | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: commit and push fixes | ||||||||||||||||||
| - name: "Commit and push transparent proxy golden files changes" | ||||||||||||||||||
| if: contains(github.event.comment.body, '/golden_files_tproxy') && steps.golden-files-tproxy.outcome == 'success' | ||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||
| env: | ||||||||||||||||||
| GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} | ||||||||||||||||||
| run: | | ||||||||||||||||||
| if git diff --exit-code --stat; then | ||||||||||||||||||
| echo "No change detected, skipping git push" | ||||||||||||||||||
| echo "No transparent proxy golden files changes detected" | ||||||||||||||||||
| else | ||||||||||||||||||
| git config user.name "${GH_USER}" | ||||||||||||||||||
| git config user.email "${GH_EMAIL}" | ||||||||||||||||||
| git commit -s -m "fix(ci): format files" . | ||||||||||||||||||
| git commit -s -m "fix(ci): update transparent proxy golden files" . | ||||||||||||||||||
| git push | ||||||||||||||||||
| fi | ||||||||||||||||||
| - run: gh api --method POST -f content='hooray' ${{ github.event.comment.url }}/reactions | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: "Post summary comment" | ||||||||||||||||||
| if: always() | ||||||||||||||||||
| env: | ||||||||||||||||||
| GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} | ||||||||||||||||||
| run: | | ||||||||||||||||||
| SUMMARY="## Workflow Results\n\n" | ||||||||||||||||||
|
|
||||||||||||||||||
| if [ "${{ steps.format.outcome }}" != "" ]; then | ||||||||||||||||||
| if [ "${{ steps.format.outcome }}" == "success" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}✅ **Format**: Succeeded and pushed\n" | ||||||||||||||||||
| elif [ "${{ steps.format.outcome }}" == "failure" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}❌ **Format**: Failed\n" | ||||||||||||||||||
| fi | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| if [ "${{ steps.golden-files.outcome }}" != "" ]; then | ||||||||||||||||||
| if [ "${{ steps.golden-files.outcome }}" == "success" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}✅ **Golden files**: Succeeded and pushed\n" | ||||||||||||||||||
| elif [ "${{ steps.golden-files.outcome }}" == "failure" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}❌ **Golden files**: Failed\n" | ||||||||||||||||||
| fi | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| if [ "${{ steps.golden-files-tproxy.outcome }}" != "" ]; then | ||||||||||||||||||
| if [ "${{ steps.golden-files-tproxy.outcome }}" == "success" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}✅ **Transparent proxy golden files**: Succeeded and pushed\n" | ||||||||||||||||||
| elif [ "${{ steps.golden-files-tproxy.outcome }}" == "failure" ]; then | ||||||||||||||||||
| SUMMARY="${SUMMARY}❌ **Transparent proxy golden files**: Failed\n" | ||||||||||||||||||
|
Comment on lines
+134
to
+165
|
||||||||||||||||||
| fi | ||||||||||||||||||
| fi | ||||||||||||||||||
|
Comment on lines
+133
to
+167
|
||||||||||||||||||
|
|
||||||||||||||||||
| gh pr comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body "$SUMMARY" | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: "Add success reaction" | ||||||||||||||||||
|
slonka marked this conversation as resolved.
|
||||||||||||||||||
| if: | | ||||||||||||||||||
| always() && | ||||||||||||||||||
| steps.format.outcome != 'failure' && | ||||||||||||||||||
| steps.golden-files.outcome != 'failure' && | ||||||||||||||||||
| steps.golden-files-tproxy.outcome != 'failure' | ||||||||||||||||||
|
Comment on lines
+174
to
+176
|
||||||||||||||||||
| steps.format.outcome != 'failure' && | |
| steps.golden-files.outcome != 'failure' && | |
| steps.golden-files-tproxy.outcome != 'failure' | |
| ( | |
| steps.format.outcome == 'success' || | |
| steps.golden-files.outcome == 'success' || | |
| steps.golden-files-tproxy.outcome == 'success' | |
| ) |
Uh oh!
There was an error while loading. Please reload this page.