Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uuid snippet to branch name #132

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions webapp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# misc
.DS_Store
*.pem
ideas.md

# debug
npm-debug.log*
Expand Down
9 changes: 6 additions & 3 deletions webapp/src/actions/createPullRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use server';

import { notFound } from 'next/navigation';
import { randomUUID } from 'crypto';

import { RepoGit } from '@/RepoGit';
import { ServerConfig, ServerProjectConfig } from '@/utils/serverConfig';
Expand Down Expand Up @@ -71,16 +72,18 @@ export default async function sendPullRequest(
}

const nowIso = new Date().toISOString().replace(/:/g, '').split('.')[0];
const branchName = 'lyra-translate-' + nowIso;
const uuidSnippet = randomUUID().substring(5);
WULCAN marked this conversation as resolved.
Show resolved Hide resolved
const branchName = 'lyra-translate-' + uuidSnippet;

await repoGit.newBranchCommitAndPush(
branchName,
langFilePaths,
`Lyra translate: ${nowIso}`,
`Lyra translate: ${nowIso}-${uuidSnippet}`,
);

const pullRequestUrl = await repoGit.createPR(
branchName,
'LYRA Translate PR: ' + nowIso,
'LYRA Translate PR: ' + uuidSnippet,
WULCAN marked this conversation as resolved.
Show resolved Hide resolved
'Created by LYRA at: ' + nowIso,
serverProjectConfig.owner,
serverProjectConfig.repo,
Expand Down