threadlines 0.1.33 → 0.1.34
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.
- package/dist/utils/metadata.js +14 -23
- package/package.json +1 -1
package/dist/utils/metadata.js
CHANGED
|
@@ -174,30 +174,21 @@ async function getCommitAuthorForEnvironment(environment, repoRoot, commitSha) {
|
|
|
174
174
|
// Format: "name <email>" (e.g., "ngrootscholten <niels.grootscholten@gmail.com>")
|
|
175
175
|
// This is more reliable than git commands, especially in shallow clones
|
|
176
176
|
const commitAuthor = process.env.CI_COMMIT_AUTHOR;
|
|
177
|
-
if (commitAuthor) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (match) {
|
|
181
|
-
return {
|
|
182
|
-
name: match[1].trim(),
|
|
183
|
-
email: match[2].trim()
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
// If format doesn't match expected pattern, try to extract anyway
|
|
187
|
-
// Some GitLab versions might format differently
|
|
188
|
-
const parts = commitAuthor.trim().split(/\s+/);
|
|
189
|
-
if (parts.length >= 2) {
|
|
190
|
-
// Assume last part is email if it contains @
|
|
191
|
-
const emailIndex = parts.findIndex(p => p.includes('@'));
|
|
192
|
-
if (emailIndex >= 0) {
|
|
193
|
-
const email = parts[emailIndex].replace(/[<>]/g, '').trim();
|
|
194
|
-
const name = parts.slice(0, emailIndex).join(' ').trim();
|
|
195
|
-
if (name && email) {
|
|
196
|
-
return { name, email };
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
177
|
+
if (!commitAuthor) {
|
|
178
|
+
throw new Error('GitLab CI: CI_COMMIT_AUTHOR environment variable is not set. ' +
|
|
179
|
+
'This should be automatically provided by GitLab CI.');
|
|
200
180
|
}
|
|
181
|
+
// Parse "name <email>" format
|
|
182
|
+
const match = commitAuthor.match(/^(.+?)\s*<(.+?)>$/);
|
|
183
|
+
if (!match) {
|
|
184
|
+
throw new Error(`GitLab CI: CI_COMMIT_AUTHOR format is invalid. ` +
|
|
185
|
+
`Expected format: "name <email>", got: "${commitAuthor}". ` +
|
|
186
|
+
`This should be automatically provided by GitLab CI in the correct format.`);
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
name: match[1].trim(),
|
|
190
|
+
email: match[2].trim()
|
|
191
|
+
};
|
|
201
192
|
}
|
|
202
193
|
// Fallback to git command for all environments (including GitHub/GitLab if env vars unavailable)
|
|
203
194
|
return await (0, diff_1.getCommitAuthor)(repoRoot, commitSha);
|