Skip to content

Integration Test Follow-up #456

Integration Test Follow-up

Integration Test Follow-up #456

name: Integration Test Follow-up
on:
workflow_run:
workflows: ["Integration Tests"]
types: [completed]
jobs:
investigate:
if: >
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.event == 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 30
env:
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
permissions:
contents: write
issues: write
pull-requests: write
actions: read
steps:
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Setup Dart SDK
uses: dart-lang/setup-dart@v1
- name: Download test results artifact
uses: actions/download-artifact@v4
with:
name: test-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ steps.generate-token.outputs.token }}
- name: Collect failure information
id: collect
uses: actions/github-script@v7
env:
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
const script = require('./.github/scripts/investigate-test-failures/collect-failures.js');
await script({ github, context, core });
- name: Check for existing issues
id: check-existing
if: steps.collect.outputs.has_failures == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
const script = require('./.github/scripts/investigate-test-failures/check-existing-issues.js');
await script({ github, context, core });
- name: Install Codex CLI
if: steps.check-existing.outputs.has_new_failures == 'true'
uses: ./.github/actions/install-ai-tools
with:
codex_config: ${{ secrets.CODEX_CONFIG }}
- name: Investigate with Codex
if: steps.check-existing.outputs.has_new_failures == 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: ./.github/scripts/investigate-test-failures/investigate.sh
- name: Write job summary
if: always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let summary = '## Integration Test Failure Investigation\n\n';
if (!fs.existsSync('failure-context.json')) {
summary += 'No failure context collected (workflow may not have had test failures).\n';
core.summary.addRaw(summary);
await core.summary.write();
return;
}
const failureContext = JSON.parse(fs.readFileSync('failure-context.json', 'utf8'));
summary += `**Workflow run:** ${failureContext.runUrl}\n\n`;
summary += `| Council | Status |\n|---------|--------|\n`;
for (const failure of failureContext.failures) {
const status = failure.needsInvestigation ? 'Investigated' : 'Skipped (existing issue)';
summary += `| ${failure.councilName} | ${status} |\n`;
}
const investigated = failureContext.failures.filter(f => f.needsInvestigation).length;
const skipped = failureContext.failures.filter(f => !f.needsInvestigation).length;
summary += `\n**${investigated}** investigated, **${skipped}** skipped (existing issues)\n`;
core.summary.addRaw(summary);
await core.summary.write();
close-resolved:
if: github.event.workflow_run.event == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
actions: read
steps:
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Download test results artifact
uses: actions/download-artifact@v4
with:
name: test-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ steps.generate-token.outputs.token }}
- name: Close resolved issues
uses: actions/github-script@v7
env:
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
const script = require('./.github/scripts/investigate-test-failures/close-resolved-issues.js');
await script({ github, context, core });