Skip to content

Commit

Permalink
fix: gitlab git command
Browse files Browse the repository at this point in the history
  • Loading branch information
lizacullis committed Aug 3, 2023
1 parent d195163 commit 4f19728
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/git/getChangedFilesNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const getChangedFilesNamesCommand = (
const { githubSha, baseSha } = getGitHubEnvVariables();
return `git diff --name-only --diff-filter=AMT ${baseSha} ${githubSha}`;
} else if (isCi === PlatformOptions.GITLAB) {
const { mergeRequestBaseSha } = getGitLabEnvVariables();
return `git diff --name-only ${mergeRequestBaseSha}...HEAD`;
const { gitlabSha, mergeRequestBaseSha } = getGitLabEnvVariables();
return `git diff --name-only --diff-filter=AMT ${mergeRequestBaseSha} ${gitlabSha}`;
}
return "git diff --name-only --diff-filter=AMT --cached";
};
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const getGitLabEnvVariables = (): Record<string, string> => {
"CI_MERGE_REQUEST_DIFF_BASE_SHA",
"CI_PROJECT_ID",
"CI_MERGE_REQUEST_IID",
"CI_COMMIT_SHA",
"GITLAB_TOKEN",
].filter((varName) => !process.env[varName]);
if (missingVars.length > 0) {
Expand All @@ -43,6 +44,7 @@ export const getGitLabEnvVariables = (): Record<string, string> => {
}
return {
mergeRequestBaseSha: process.env.CI_MERGE_REQUEST_DIFF_BASE_SHA as string,
gitlabSha: process.env.CI_COMMIT_SHA as string,
gitlabToken: process.env.GITLAB_TOKEN as string,
projectId: process.env.CI_PROJECT_ID as string,
mergeRequestIIdString: process.env.CI_MERGE_REQUEST_IID as string,
Expand Down

0 comments on commit 4f19728

Please sign in to comment.