-
Notifications
You must be signed in to change notification settings - Fork 374
Add notify-failure job to cgo.yml for CGO failure tracking #28613
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 all 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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1684,3 +1684,99 @@ jobs: | |||||||||
| name: safe-outputs-conformance-report | ||||||||||
| path: conformance-output.txt | ||||||||||
| retention-days: 7 | ||||||||||
|
|
||||||||||
| notify-failure: | ||||||||||
| name: Notify on CGO Failure | ||||||||||
| runs-on: ubuntu-latest | ||||||||||
| timeout-minutes: 5 | ||||||||||
| if: always() && github.ref == 'refs/heads/main' | ||||||||||
| needs: | ||||||||||
| - test | ||||||||||
| - canary-go | ||||||||||
| - build | ||||||||||
| - build-wasm | ||||||||||
| - validate-yaml | ||||||||||
| - bench | ||||||||||
| - check-validator-sizes | ||||||||||
| - lint-go | ||||||||||
| - actions-build | ||||||||||
| - fuzz | ||||||||||
| - security | ||||||||||
| - security-scan | ||||||||||
| - mcp-server-compile-test | ||||||||||
| - cross-platform-build | ||||||||||
| - alpine-container-test | ||||||||||
| - safe-outputs-conformance | ||||||||||
| permissions: | ||||||||||
| issues: write | ||||||||||
| steps: | ||||||||||
| - name: Check for job failures and create issue | ||||||||||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | ||||||||||
| with: | ||||||||||
| script: | | ||||||||||
| const needs = ${{ toJSON(needs) }}; | ||||||||||
| const failedJobs = Object.entries(needs) | ||||||||||
| .filter(([, job]) => job.result === 'failure') | ||||||||||
| .map(([name]) => name); | ||||||||||
|
|
||||||||||
| if (failedJobs.length === 0) { | ||||||||||
| core.info('No jobs failed. Nothing to do.'); | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| core.info(`Failed jobs: ${failedJobs.join(', ')}`); | ||||||||||
|
|
||||||||||
| // Check for an existing open CGO failure issue to avoid duplicates | ||||||||||
| const existingIssues = await github.rest.issues.listForRepo({ | ||||||||||
| owner: context.repo.owner, | ||||||||||
| repo: context.repo.repo, | ||||||||||
| labels: 'cgo-failure', | ||||||||||
| state: 'open', | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| if (existingIssues.data.length > 0) { | ||||||||||
| core.info(`Existing CGO failure issue #${existingIssues.data[0].number} is still open. Skipping.`); | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // Ensure required labels exist, creating them if missing | ||||||||||
| for (const [label, color] of [['cookie', 'e4e669'], ['cgo-failure', 'b60205']]) { | ||||||||||
| try { | ||||||||||
| await github.rest.issues.getLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label }); | ||||||||||
| } catch (e) { | ||||||||||
| if (e.status === 404) { | ||||||||||
| await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color }); | ||||||||||
|
||||||||||
| await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color }); | |
| await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, name: label, color }); | |
| } else { | |
| throw new Error(`Failed to verify label "${label}": ${e.message}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github.rest.issues.listForReporeturns both issues and pull requests. If a PR is ever labeledcgo-failure, this deduplication check will incorrectly suppress issue creation. Filter out items with thepull_requestfield (or use a search query that excludes PRs) before deciding to skip creating a new issue.