@monoweave/git 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gitCommands.d.ts +4 -2
- package/lib/gitCommands.js +4 -4
- package/package.json +1 -1
package/lib/gitCommands.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { type YarnContext } from '@monoweave/types';
|
|
2
|
-
export declare const gitUpstreamBranch: ({ cwd, context, }: {
|
|
2
|
+
export declare const gitUpstreamBranch: ({ cwd, context, remote, }: {
|
|
3
3
|
cwd: string;
|
|
4
4
|
context?: YarnContext | undefined;
|
|
5
|
+
remote: string;
|
|
5
6
|
}) => Promise<string>;
|
|
6
7
|
export declare const gitCheckout: ({ files }: {
|
|
7
8
|
files: string[];
|
|
8
|
-
}, { cwd, context }: {
|
|
9
|
+
}, { cwd, context, remote }: {
|
|
9
10
|
cwd: string;
|
|
10
11
|
context?: YarnContext | undefined;
|
|
12
|
+
remote: string;
|
|
11
13
|
}) => Promise<void>;
|
|
12
14
|
export declare const gitResolveSha: (ref: string, { cwd, context }: {
|
|
13
15
|
cwd: string;
|
package/lib/gitCommands.js
CHANGED
|
@@ -35,14 +35,14 @@ const git = async (subcommand, { cwd, context }) => {
|
|
|
35
35
|
logging_1.default.debug(`[Exec] ${command}`, { report: context?.report });
|
|
36
36
|
return await (0, io_1.exec)(command, { cwd, env: { GIT_TERMINAL_PROMPT: '0', ...process.env } });
|
|
37
37
|
};
|
|
38
|
-
const gitUpstreamBranch = async ({ cwd, context, }) => {
|
|
38
|
+
const gitUpstreamBranch = async ({ cwd, context, remote, }) => {
|
|
39
39
|
if (process.env.GITHUB_ACTION) {
|
|
40
40
|
if (process.env.GITHUB_REF && process.env.GITHUB_EVENT_NAME === 'push') {
|
|
41
41
|
// In GitHub actions for push events, we can use GITHUB_REF.
|
|
42
42
|
return process.env.GITHUB_REF;
|
|
43
43
|
}
|
|
44
44
|
if (process.env.GITHUB_BASE_REF && process.env.GITHUB_EVENT_NAME === 'pull_request') {
|
|
45
|
-
return process.env.GITHUB_BASE_REF
|
|
45
|
+
return `${remote}/${process.env.GITHUB_BASE_REF}`;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
const { stdout: branch } = await git('rev-parse --abbrev-ref --symbolic-full-name @\\{u\\}', {
|
|
@@ -52,8 +52,8 @@ const gitUpstreamBranch = async ({ cwd, context, }) => {
|
|
|
52
52
|
return branch;
|
|
53
53
|
};
|
|
54
54
|
exports.gitUpstreamBranch = gitUpstreamBranch;
|
|
55
|
-
const gitCheckout = async ({ files }, { cwd, context }) => {
|
|
56
|
-
const branch = await (0, exports.gitUpstreamBranch)({ cwd, context });
|
|
55
|
+
const gitCheckout = async ({ files }, { cwd, context, remote }) => {
|
|
56
|
+
const branch = await (0, exports.gitUpstreamBranch)({ cwd, context, remote });
|
|
57
57
|
await git(`checkout ${branch.trim()} -- ${files.map((f) => `"${f}"`).join(' ')}`, {
|
|
58
58
|
cwd,
|
|
59
59
|
context,
|