mirror of
https://github.com/Earth-Genesis-Games/Carrasco.git
synced 2026-09-11 09:52:19 +00:00
Auto-create issue on Unity test failure
Mirrors pr-conflict-check.yml's pattern on the default branch so it's active immediately instead of waiting for refactor-2026 to merge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,10 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Run Unity Tests
|
name: Run Unity Tests
|
||||||
@@ -39,3 +43,60 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: test-results/
|
path: test-results/
|
||||||
|
|
||||||
|
report-failure:
|
||||||
|
name: Open issue on test failure
|
||||||
|
needs: test
|
||||||
|
if: failure()
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create or update tracking issue
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
||||||
|
const isPR = context.eventName === 'pull_request';
|
||||||
|
|
||||||
|
const subject = isPR
|
||||||
|
? `PR #${context.payload.pull_request.number} ("${context.payload.pull_request.title}")`
|
||||||
|
: `commit ${context.sha.substring(0, 7)} on \`${context.ref.replace('refs/heads/', '')}\``;
|
||||||
|
|
||||||
|
const title = isPR
|
||||||
|
? `Unity tests failing: PR #${context.payload.pull_request.number}`
|
||||||
|
: `Unity tests failing on ${context.ref.replace('refs/heads/', '')}`;
|
||||||
|
|
||||||
|
const body = [
|
||||||
|
`The **Automated Tests** workflow failed for ${subject}.`,
|
||||||
|
'',
|
||||||
|
`**Workflow run**: ${runUrl}`,
|
||||||
|
'',
|
||||||
|
'Check the Edit Mode / Play Mode test results artifact attached to the run',
|
||||||
|
'above for the specific failing test(s). This issue will stay open until a',
|
||||||
|
'follow-up run passes — close it manually once resolved.',
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
const { data: existing } = await github.rest.issues.listForRepo({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
state: 'open',
|
||||||
|
labels: 'ci-failure',
|
||||||
|
});
|
||||||
|
|
||||||
|
const match = existing.find(issue => issue.title === title);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: match.number,
|
||||||
|
body: `Still failing as of ${runUrl}.`,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await github.rest.issues.create({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
labels: ['ci-failure'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user