Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
save
  • Loading branch information
Nikhil Thorat committed Sep 9, 2019
commit 9fb13d3f9abe1608536d554607599f07029f31cf
1 change: 0 additions & 1 deletion cloudbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ steps:
- 'COMMIT_SHA=$COMMIT_SHA'
- 'BRANCH_NAME=$BRANCH_NAME'
- 'REPO_NAME=$REPO_NAME'
- 'REPO_OWNER=$REPO_OWNER'

# Core.
- name: 'gcr.io/cloud-builders/gcloud'
Expand Down
24 changes: 15 additions & 9 deletions scripts/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const dirs = readdirSync('.').filter(f => {
return f !== 'node_modules' && f !== '.git' && statSync(f).isDirectory();
});

console.log(process.env);
console.log('REPO NAME', process.env['REPO_NAME']);
let commitSha = process.env['COMMIT_SHA'];
let branchName = process.env['BRANCH_NAME'];
Expand All @@ -53,14 +52,23 @@ exec(
`https://github.com/tensorflow/tfjs ${CLONE_PATH}`);

shell.cd(CLONE_PATH);
exec(`git checkout ${branchName}`);
const mergeBase = exec(`git merge-base master ${branchName}`).stdout.trim();
exec(`git fetch origin ${mergeBase}`);
exec(`git checkout ${mergeBase}`);
shell.cd('..');

// If we cannot check out the commit given by cloud CI then this PR is coming
// from a fork.
const res = shell.exec(`git checkout ${commitSha}`);
const isPullRequestFromFork = res.code !== 0;

// Only checkout the merge base if the pull requests comes from a
// tensorflow/tfjs branch. Otherwise clone master and diff against master.
if (!isPullRequestFromFork) {
exec(`git checkout ${branchName}`);
const mergeBase = exec(`git merge-base master ${branchName}`).stdout.trim();
exec(`git fetch origin ${mergeBase}`);
exec(`git checkout ${mergeBase}`);
console.log('mergeBase: ', mergeBase);
}

console.log('mergeBase: ', mergeBase);
shell.cd('..');

let triggerAllBuilds = false;
let whitelistDiffOutput = [];
Expand Down Expand Up @@ -109,5 +117,3 @@ function diff(fileOrDirName) {
`${fileOrDirName}`;
return exec(diffCmd, {silent: true}, true).stdout.trim();
}

console.log(shell.exec(`cat ./tfjs-node/diff`).stdout);