-
Notifications
You must be signed in to change notification settings - Fork 570
[ci] Add failure notification for package docs validation #18034
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cda803a
[ci] Remove continue-on-error, add failure notification workflow
theletterf 2d91257
[ci] Keep continue-on-error, notify via artifact signal
theletterf 1818cab
Address review: env vars for injection safety, --body-file for comment
theletterf 23f7eb6
Replace ingest-docs with integration-docs, add #docs channel reference
theletterf e5a7260
Merge branch 'main' into ci/docs-validation-notify
theletterf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| name: Notify on Package Docs Validation Failure | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Validate Package Docs"] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| notify: | ||
| name: Comment on PR | ||
| if: github.event.workflow_run.event == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download failure signal | ||
| id: artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: docs-validation-failed | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| github-token: ${{ github.token }} | ||
| path: .validate-result | ||
| continue-on-error: true | ||
|
|
||
| - name: Comment on PR | ||
| if: steps.artifact.outcome == 'success' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RUN_URL: ${{ github.event.workflow_run.html_url }} | ||
| REPO: ${{ github.repository }} | ||
| run: | | ||
| PR_NUMBER=$(cat .validate-result/pr_number) | ||
| [ -z "$PR_NUMBER" ] && exit 0 | ||
| # Avoid duplicate comments | ||
| EXISTING=$(gh api "repos/${REPO}/issues/${PR_NUMBER}/comments" \ | ||
| --jq '[.[] | select(.body | contains("Package docs validation failed"))] | length') | ||
| if [ "$EXISTING" = "0" ]; then | ||
| printf '⚠️ **Package docs validation failed.** Please check the [workflow run](%s) for details.\n\nFor support, reach out in the #docs Slack channel.\n\ncc @elastic/integration-docs\n' "$RUN_URL" > comment-body.md | ||
| gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file comment-body.md | ||
| fi | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.