Skip to content

Commit

Permalink
fix: checkout branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mathio committed Jan 17, 2025
1 parent a2d43c1 commit 07a8565
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- action/**
branches:
- main
- action

jobs:
docker:
Expand Down
9 changes: 9 additions & 0 deletions action/src/flows/in-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,20 @@ export class InBranchFlow extends IntegrationFlow {
}

private configureGit() {
const { baseBranchName } = this.platformKit.platformConfig;

execSync(`git config --global safe.directory ${process.cwd()}`);

execSync(`git config user.name "${gitConfig.userName}"`);
execSync(`git config user.email "${gitConfig.userEmail}"`);

try {
execSync(`git branch ${baseBranchName}`, { stdio: "inherit" });
} catch (e) {
// the branch exists
}
execSync(`git checkout ${baseBranchName}`, { stdio: "inherit" });

const currentAuthor = `${gitConfig.userName} <${gitConfig.userEmail}>`;
const authorOfLastCommit = execSync(
`git log -1 --pretty=format:'%an <%ae>'`,
Expand Down

0 comments on commit 07a8565

Please sign in to comment.