playwright-slack-report-burak 3.0.13 → 3.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,84 +150,22 @@ class SlackReporter {
150
150
  let currentJob = null;
151
151
  let jobGroup = null;
152
152
 
153
- // Strategy 1: Find the currently running job (status: in_progress or completed recently)
154
- const runningJobs = jobs.filter(j => j.status === 'in_progress' || j.status === 'queued');
155
- this.log(`🔍 [GitHub Actions Detection] Found ${runningJobs.length} running/queued job(s)`);
156
-
157
- if (runningJobs.length === 1) {
158
- // Perfect - only one job is running, must be us
159
- currentJob = runningJobs[0];
160
- const normalizedName = normalizeJobName(currentJob.name);
161
- jobGroup = jobGroups[normalizedName];
162
- this.log(`🔍 [GitHub Actions Detection] Matched by running status: "${currentJob.name}"`);
163
- } else if (runningJobs.length > 1) {
164
- // Multiple running jobs - try to match by job ID or name
165
- for (const job of runningJobs) {
166
- // Check if this job's name contains the GITHUB_JOB id
167
- // But be more specific - avoid matching "Generate test matrix" when looking for "test"
168
- const jobIdLower = currentJobId.toLowerCase();
169
- const jobNameLower = (job.name || '').toLowerCase();
170
-
171
- // Match if job name starts with or equals the job ID (more specific)
172
- if (jobNameLower.startsWith(jobIdLower) ||
173
- jobNameLower.includes(`${jobIdLower} `) ||
174
- jobNameLower.includes(`${jobIdLower}(`) ||
175
- jobNameLower === jobIdLower) {
176
- currentJob = job;
177
- const normalizedName = normalizeJobName(job.name);
178
- jobGroup = jobGroups[normalizedName];
179
- this.log(`🔍 [GitHub Actions Detection] Matched running job by ID match: "${job.name}"`);
180
- break;
181
- }
182
- }
183
-
184
- // Still no match? Take the first running job that looks like a test job
185
- if (!currentJob) {
186
- for (const job of runningJobs) {
187
- if (job.name && (job.name.includes('shard') || job.name.includes('test') || job.name.includes('matrix'))) {
188
- currentJob = job;
189
- const normalizedName = normalizeJobName(job.name);
190
- jobGroup = jobGroups[normalizedName];
191
- this.log(`🔍 [GitHub Actions Detection] Matched by test-like name: "${job.name}"`);
192
- break;
193
- }
194
- }
195
- }
196
- }
197
-
198
- // Strategy 2: If no running job found, look at all jobs
199
- if (!currentJob) {
200
- this.log(`🔍 [GitHub Actions Detection] No running job matched, checking all jobs`);
201
- for (const job of jobs) {
202
- const jobIdLower = currentJobId.toLowerCase();
203
- const jobNameLower = (job.name || '').toLowerCase();
204
-
205
- if (jobNameLower.startsWith(jobIdLower) ||
206
- jobNameLower.includes(`${jobIdLower} `) ||
207
- jobNameLower.includes(`${jobIdLower}(`)) {
208
- currentJob = job;
209
- const normalizedName = normalizeJobName(job.name);
210
- jobGroup = jobGroups[normalizedName];
211
- this.log(`🔍 [GitHub Actions Detection] Matched job by name: "${job.name}"`);
212
- break;
213
- }
153
+ // First, try to find by job name match
154
+ for (const job of jobs) {
155
+ if (job.name && (job.name.includes(currentJobId) || currentJobId.includes(job.name))) {
156
+ currentJob = job;
157
+ const normalizedName = normalizeJobName(job.name);
158
+ jobGroup = jobGroups[normalizedName];
159
+ this.log(`🔍 [GitHub Actions Detection] Matched current job by name: "${job.name}"`);
160
+ break;
214
161
  }
215
162
  }
216
163
 
217
- // Fallback: Use the largest job group (likely the matrix jobs)
164
+ // If still no match, use all jobs as fallback
218
165
  if (!jobGroup || jobGroup.length === 0) {
219
- this.log(`🔍 [GitHub Actions Detection] Could not match job, using largest job group`);
220
- let largestGroup = [];
221
- let largestGroupName = '';
222
- for (const [groupName, groupJobs] of Object.entries(jobGroups)) {
223
- if (groupJobs.length > largestGroup.length) {
224
- largestGroup = groupJobs;
225
- largestGroupName = groupName;
226
- }
227
- }
228
- jobGroup = largestGroup;
229
- currentJob = jobGroup[0];
230
- this.log(`🔍 [GitHub Actions Detection] Using largest group "${largestGroupName}" with ${jobGroup.length} job(s)`);
166
+ this.log(`🔍 [GitHub Actions Detection] Could not match job, using all jobs as group`);
167
+ jobGroup = jobs;
168
+ currentJob = jobs[0];
231
169
  }
232
170
  // Sort jobs by name or ID to get consistent ordering
233
171
  jobGroup.sort((a, b) => {
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "lint-fix": "npx eslint . --ext .ts --fix"
33
33
  },
34
34
  "name": "playwright-slack-report-burak",
35
- "version": "3.0.13",
35
+ "version": "3.0.112",
36
36
  "main": "index.js",
37
37
  "types": "dist/index.d.ts",
38
38
  "author": "Burak B. <burak.boluk@hotmail.com>",