@@ -110,28 +110,58 @@ jobs:
110
110
with :
111
111
script : |
112
112
const needsContext = JSON.parse(process.env.NEEDS_CONTEXT);
113
- const failedJobs = Object.keys(needsContext)
114
- .filter(jobName => 'failure' === needsContext[jobName].result)
115
- .map(jobName => `- **${needsContext[jobName].outputs.name || jobName}**: Failed`);
116
113
117
- const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
118
- const title = `E2E Test Failure: ${new Date().toISOString().split('T')[0]}`;
119
-
120
- const body = `
121
- The daily end-to-end test workflow has failed.
122
-
123
- This means users may be experiencing issues installing the Symfony Demo application.
114
+ // Map job ids to human-readable names used in the workflow UI
115
+ const jobNames = {
116
+ 'test-symfony-cli-installation': 'Test Symfony CLI Installation',
117
+ 'test-composer-create-project': 'Test Composer Create Project',
118
+ 'test-git-clone-installation': 'Test Git Clone Installation',
119
+ };
124
120
125
- ### Failed Jobs:
126
- ${failedJobs.join('\n')}
121
+ const failedJobs = Object.entries(needsContext)
122
+ .filter(([, v]) => v.result === 'failure')
123
+ .map(([id]) => `- **${jobNames[id] || id}**: failed`);
127
124
128
- Please investigate and fix the installation issues as soon as possible.
129
- `;
130
-
131
- await github.rest.issues.create({
132
- owner: context.repo.owner,
133
- repo: context.repo.repo,
134
- title: title,
135
- body: body,
136
- labels: ['bug']
125
+ const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
126
+ const date = new Date().toISOString().split('T')[0];
127
+ const title = `E2E Test Failure: ${date}`;
128
+
129
+ const body = [
130
+ 'The daily end-to-end test workflow has failed.',
131
+ '',
132
+ 'This may indicate users are experiencing issues installing the Symfony Demo application.',
133
+ '',
134
+ `**Run**: ${runUrl}`,
135
+ '',
136
+ '### Failed Jobs',
137
+ failedJobs.join('\n'),
138
+ '',
139
+ 'Please investigate and fix the installation issues as soon as possible.'
140
+ ].join('\n');
141
+
142
+ // Ensure label exists
143
+ const owner = context.repo.owner;
144
+ const repo = context.repo.repo;
145
+ const labelName = 'bug';
146
+ try {
147
+ await github.rest.issues.getLabel({ owner, repo, name: labelName });
148
+ } catch {
149
+ await github.rest.issues.createLabel({
150
+ owner, repo, name: labelName, color: 'd73a4a', description: 'Something is broken'
151
+ });
152
+ }
153
+
154
+ // Reuse an open issue for today if it already exists to avoid duplicates
155
+ const { data: issues } = await github.rest.issues.listForRepo({
156
+ owner, repo, state: 'open', labels: labelName, per_page: 100
137
157
});
158
+ const existing = issues.find(i => i.title === title);
159
+
160
+ if (existing) {
161
+ await github.rest.issues.createComment({
162
+ owner, repo, issue_number: existing.number,
163
+ body: `Another failing run detected.\n\n${body}`
164
+ });
165
+ } else {
166
+ await github.rest.issues.create({ owner, repo, title, body, labels: [labelName] });
167
+ }
0 commit comments