File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,60 @@ jobs:
124124 core.setOutput(key, value);
125125 }
126126
127+ // --- Extract END_SHA from env of "Check failed tests" step ---
128+ let endSha = null;
129+ let inTargetStep = false;
130+ let inEnvBlock = false;
131+ let stepDepth = 0;
132+
133+ for (const line of logText.split('\n')) {
134+ const content = line.replace(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z /, '');
135+
136+ if (content.includes('##[group]') ) {
137+ if (content.includes('Check failed tests')) {
138+ inTargetStep = true;
139+ stepDepth = 1;
140+ continue;
141+ } else if (inTargetStep) {
142+ stepDepth++;
143+ }
144+ }
145+
146+ if (!inTargetStep) continue;
147+
148+ if (content.includes('##[endgroup]')) {
149+ stepDepth--;
150+ if (stepDepth <= 0) break; // exited the step
151+ inEnvBlock = false;
152+ continue;
153+ }
154+
155+ if (content.trim() === 'env:') {
156+ inEnvBlock = true;
157+ continue;
158+ }
159+
160+ if (inEnvBlock) {
161+ const match = content.match(/^\s+END_SHA:\s*(.+)/);
162+ if (match) {
163+ endSha = match[1].trim();
164+ break;
165+ }
166+ // stop if we've left the env block (next non-indented line)
167+ if (content.trim() && !content.startsWith(' ')) {
168+ inEnvBlock = false;
169+ }
170+ }
171+ }
172+
173+ if (endSha) {
174+ console.log(`END_SHA: ${endSha}`);
175+ core.setOutput('END_SHA', endSha);
176+ } else {
177+ core.warning('Could not find END_SHA in the "Check failed tests" step env block.');
178+ }
179+
180+
127181 check_new_failures :
128182 name : Check new failures
129183 needs : prepare
You can’t perform that action at this time.
0 commit comments