Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature handle build issues#15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromfeature/validate
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
return to original branch even in failure
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedMay 31, 2020
commitc8e9721639559c0e2fb7597855f9a399935b77bf
60 changes: 32 additions & 28 deletionssrc/utils/commits.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,41 +45,45 @@ export async function getCommits({
throw new Error(`Code branch "${codeBranch}" not found`);
}

console.log("branches", branches);

// Checkout the code branches
await git.checkout(codeBranch);

console.log("checked out");

// Load all logs
const logs = await git.log();

console.log("logs", logs);
// track the original branch in case of failure
const originalBranch = branches.current;

// Filter relevant logs
const commits: CommitLogObject = {};

for (const commit of logs.all) {
const matches = commit.message.match(
/^(?<stepId>(?<levelId>L\d+)(S\d+))(?<stepType>[QA])?/
);

if (matches && matches.length) {
// Use an object of commit arrays to collect all commits
const position = matches[0];
if (!commits[position]) {
// does not exist, create the list
commits[position] = [commit.hash];
} else {
// add to the list
commits[position].push(commit.hash);
try {
// Checkout the code branches
await git.checkout(codeBranch);

// Load all logs
const logs = await git.log();

for (const commit of logs.all) {
const matches = commit.message.match(
/^(?<stepId>(?<levelId>L\d+)(S\d+))(?<stepType>[QA])?/
);

if (matches && matches.length) {
// Use an object of commit arrays to collect all commits
const position = matches[0];
if (!commits[position]) {
// does not exist, create the list
commits[position] = [commit.hash];
} else {
// add to the list
commits[position].push(commit.hash);
}
}
}
} catch (e) {
console.error("Error with checkout or commit matching");
throw new Error(e.message);
} finally {
// revert back to the original branch on failure
await git.checkout(originalBranch);
// cleanup the tmp directory
await rmdir(tmpDir, { recursive: true });
}

console.log("remove");
// cleanup the tmp directory
await rmdir(tmpDir, { recursive: true });
return commits;
}
2 changes: 1 addition & 1 deletionsrc/utils/schema/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -193,7 +193,7 @@ export default {
"The solution commits that can be loaded if the user gets stuck. It can also run commands and/or open files",
},
{
required: ["commits"],
required: [],
},
],
},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp