Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 58 additions & 23 deletions .github/workflows/end_to_end_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
symfony server:stop

notify-on-failure:
if: failure()
if: ${{ always() && contains(needs.*.result, 'failure') }}
name: Notify on Failure
needs: [test-symfony-cli-installation, test-composer-create-project, test-git-clone-installation]
runs-on: ubuntu-latest
Expand All @@ -105,28 +105,63 @@ jobs:
steps:
- name: Create Issue on Failure
uses: actions/github-script@v7
env:
NEEDS_CONTEXT: ${{ toJSON(needs) }}
with:
script: |
const title = `End to End Test Failed - ${new Date().toISOString().split('T')[0]}`;
const body = `The daily end to end test workflow has failed.

This means users may be experiencing issues installing the Symfony Demo application.

**Failed Jobs:**
- Check the workflow run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

**Installation Methods Tested:**
- Symfony CLI installation
- Composer create-project
- Git clone + composer install

Please investigate and fix the installation issues as soon as possible.
`;

github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['bug']
const needsContext = JSON.parse(process.env.NEEDS_CONTEXT);

// Map job ids to human-readable names used in the workflow UI
const jobNames = {
'test-symfony-cli-installation': 'Test Symfony CLI Installation',
'test-composer-create-project': 'Test Composer Create Project',
'test-git-clone-installation': 'Test Git Clone Installation',
};

const failedJobs = Object.entries(needsContext)
.filter(([, v]) => v.result === 'failure')
.map(([id]) => `- **${jobNames[id] || id}**: failed`);

const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
const date = new Date().toISOString().split('T')[0];
const title = `E2E Test Failure: ${date}`;

const body = [
'The daily end-to-end test workflow has failed.',
'',
'This may indicate users are experiencing issues installing the Symfony Demo application.',
'',
`**Run**: ${runUrl}`,
'',
'### Failed Jobs',
failedJobs.join('\n'),
'',
'Please investigate and fix the installation issues as soon as possible.'
].join('\n');

// Ensure label exists
const owner = context.repo.owner;
const repo = context.repo.repo;
const labelName = 'bug';
try {
await github.rest.issues.getLabel({ owner, repo, name: labelName });
} catch {
await github.rest.issues.createLabel({
owner, repo, name: labelName, color: 'd73a4a', description: 'Something is broken'
});
}

// Reuse an open issue for today if it already exists to avoid duplicates
const { data: issues } = await github.rest.issues.listForRepo({
owner, repo, state: 'open', labels: labelName, per_page: 100
});
const existing = issues.find(i => i.title === title);

if (existing) {
await github.rest.issues.createComment({
owner, repo, issue_number: existing.number,
body: `Another failing run detected.\n\n${body}`
});
} else {
await github.rest.issues.create({ owner, repo, title, body, labels: [labelName] });
}
Loading