Skip to content

Commit

Permalink
Don't commit untracked files
Browse files Browse the repository at this point in the history
  • Loading branch information
richardolsson committed Dec 16, 2023
1 parent afaf275 commit eb3ead2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webapp/src/app/api/pull-request/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export async function POST() {
await git.pull();
const store = await Cache.getStore();
const languages = await store.getLanguageData();
const pathsToAdd: string[] = [];
for (const lang of Object.keys(languages)) {
// TODO: 1. make it multi projects
// 2. use path to avoid double slash
Expand All @@ -48,6 +49,7 @@ export async function POST() {
doubleQuotedAsJSON: true,
singleQuote: true,
});
pathsToAdd.push(yamlPath);
await fs.writeFile(yamlPath, yamlOutput);
}
const status = await git.status();
Expand All @@ -60,7 +62,7 @@ export async function POST() {
const nowIso = new Date().toISOString().replace(/:/g, '').split('.')[0];
const branchName = 'lyra-translate-' + nowIso;
await git.checkoutBranch(branchName, lyraconfig.baseBranch);
await git.add('.');
await git.add(pathsToAdd);
await git.commit('Lyra Translate: ' + nowIso);
await git.push(['-u', 'origin', branchName]);
const pullRequestUrl = await createPR(
Expand Down

0 comments on commit eb3ead2

Please sign in to comment.