Skip to content

Commit

Permalink
chore: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
commiter committed Sep 3, 2024
1 parent e900f60 commit 4b0e183
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
15 changes: 7 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions src/copy.bara.sky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PUSH_INCLUDE = [${pushInclude}]
PUSH_EXCLUDE = [${pushExclude}]
PUSH_TRANSFORMATIONS = [${pushTransformations}]
PR_INCLUDE = ["${prInclude}"]
PR_INCLUDE = [${prInclude}]
PR_EXCLUDE = [${prExclude}]
PR_TRANSFORMATIONS = [${prTransformations}]
Expand Down Expand Up @@ -71,14 +71,12 @@ core.workflow(
body = PR_BODY,
integrates = [],
),
destination_files = glob(PUSH_INCLUDE, exclude = PUSH_EXCLUDE),
origin_files = glob(PR_INCLUDE if PR_INCLUDE else ["**"], exclude = PR_EXCLUDE),
destination_files = glob(PUSH_INCLUDE, exclude = PUSH_EXCLUDE),
authoring = authoring.pass_thru(default = COMMITTER),
mode = "CHANGE_REQUEST",
set_rev_id = False,
transformations = [
metadata.save_author("ORIGINAL_AUTHOR"),
metadata.expose_label("GITHUB_PR_NUMBER", new_name = "Closes", separator = DESTINATION_REPO.replace("[email protected]:", " ").replace(".git", "#")),
] + PR_TRANSFORMATIONS,
)
`;
`;
9 changes: 5 additions & 4 deletions src/copybara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export class CopyBara {

console.log(copybaraOptions);
switch (workflow) {
case "init":
case "push":
return this.exec(
["-e", "COPYBARA_WORKFLOW=push"],
["--force", "--init-history", "--ignore-noop", ...copybaraOptions]
["--force", ...copybaraOptions]
);

case "pr":
return this.exec(
["-e", "COPYBARA_WORKFLOW=pr", "-e", `COPYBARA_SOURCEREF=${ref}`],
["--ignore-noop", ...copybaraOptions]
["--force", ...copybaraOptions]
);

default:
Expand Down Expand Up @@ -103,6 +103,7 @@ export class CopyBara {

private static generateInExcludes(inExcludesArray: string[]) {
const inExcludeGlobs = inExcludesArray.filter((v) => v);
console.log(inExcludesArray)
let inExcludeString = "";

if (inExcludeGlobs.length) inExcludeString = `"${inExcludeGlobs.join('","')}"`;
Expand All @@ -129,7 +130,7 @@ export class CopyBara {
const glob = path ? path : "**";

transformation = transformation.concat(`
core.${method}("${from}", "${to}", paths = glob(["${glob}"])),`);
core.${method}("${from}", "${to}"),`);
}
});

Expand Down

0 comments on commit 4b0e183

Please sign in to comment.