Skip to content

Commit

Permalink
Include checkin_by and checkin_date as part of changelist information (
Browse files Browse the repository at this point in the history
  • Loading branch information
jag-j authored Jul 14, 2020
1 parent 2597f7c commit dbe8c53
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
12 changes: 8 additions & 4 deletions api/actions/__test__/createChangelist.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const req = {
sha: '654321',
repo: { html_url: 'https://github.com/Codertocat/Hello-World' }
},
merge_commit_sha: '123456'
merge_commit_sha: '123456',
merged_at: '2019-05-15T15:20:33Z'
}
}
};
Expand All @@ -44,7 +45,8 @@ const reqWithWorkItemInBody = {
head: {
sha: '654321',
repo: { html_url: 'https://github.com/Codertocat/Hello-World' }
}
},
merged_at: '2019-05-15T15:20:33Z'
}
}
};
Expand Down Expand Up @@ -85,7 +87,8 @@ describe('createChangelist action', () => {

expect(Gus.createChangelistInGus).toHaveBeenCalledWith(
'Codertocat/Hello-World/commit/123456',
'a071234'
'a071234',
'2019-05-15T15:20:33Z'
);
});

Expand All @@ -97,7 +100,8 @@ describe('createChangelist action', () => {

expect(Gus.createChangelistInGus).toHaveBeenCalledWith(
'Codertocat/Hello-World/pull/2',
'a071234'
'a071234',
'2019-05-15T15:20:33Z'
);
});

Expand Down
3 changes: 2 additions & 1 deletion api/actions/createChangelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
html_url: pr_url,
body,
merge_commit_sha,
merged_at,
head: {
repo: { html_url: repo_url }
}
Expand All @@ -38,7 +39,7 @@ module.exports = {
pr_url
);
const issueId = await Gus.getWorkItemIdByName(workItemName);
Gus.createChangelistInGus(changelistUrl, issueId);
Gus.createChangelistInGus(changelistUrl, issueId, merged_at);
}
}
};
10 changes: 8 additions & 2 deletions api/services/Gus/createChangelistInGus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

const jsforce = require('jsforce');

module.exports = function createChangelistInGus(relativeUrl, issueId) {
module.exports = function createChangelistInGus(
relativeUrl,
issueId,
mergedAt
) {
const conn = new jsforce.Connection();
conn.login(process.env.GUS_USERNAME, process.env.GUS_PASSWORD, err => {
if (err) {
Expand All @@ -18,7 +22,9 @@ module.exports = function createChangelistInGus(relativeUrl, issueId) {
Perforce_Changelist__c: relativeUrl,
Work__c: issueId,
External_ID__c: relativeUrl,
Source__c: 'GitHub'
Source__c: 'GitHub',
Check_In_Date__c: mergedAt,
Check_In_By__c: process.env.GUS_USER
},
(err, ret) => {
if (err || !ret.success) {
Expand Down

0 comments on commit dbe8c53

Please sign in to comment.