feat: several Git2Gus improvements. See the details in description.#62
feat: several Git2Gus improvements. See the details in description.#62reiniergs merged 9 commits intoforcedotcom:masterfrom
Conversation
jag-j
commented
Apr 16, 2020
- Show github issue link in the description of the created GUS work item (W-7251050 (https://gus.my.salesforce.com/a07B00000087CpBIAU))
- Prepend a custom-text to the subject line of issues (W-7387696 (https://gus.my.salesforce.com/a07B0000008BGDZIA4))
- Do not post created GUS work item as a comment, but rather update the initial comment (W-7251060 (https://gus.my.salesforce.com/a07B00000087CpVIAU))
- Fix description formatting for newly created work items (W-7251029 (https://gus.my.salesforce.com/a07B00000087Co8IAE))
- Show GUS work item as a hyperlink.
…Prepend custom text in subject line
…fore creating GUS work
| url: 'github/git2gus-test/#30', | ||
| title: 'new issue', | ||
| body: 'some description', | ||
| body: '### some title\nsome description', |
There was a problem hiding this comment.
Test to make sure we process markdown.
| }; | ||
|
|
||
| describe('createGusItem action', () => { | ||
| it('should call queue push with the right values', async () => { |
There was a problem hiding this comment.
Felt this was a redundant test. Changed it to make sure we process we strip down markdown to GUS formatting.
| req, | ||
| body: | ||
| 'Sorry we could wait until Heroku connect make the syncronization.' | ||
| 'Sorry we could wait until Heroku connect make the synchronization.' |
There was a problem hiding this comment.
is this message saying we could not wait until heroku connect could make the syncronization? or that we had to wait until heroku connect could make the synchronization?
There was a problem hiding this comment.
Good point! I should be "could not". @reiniergs - thoughts ?
api/actions/createWorkItem.js
Outdated
| } = req.body; | ||
| const { config } = req.git2gus; | ||
| const { hideWorkItemUrl } = config; | ||
| const { suppressGithubComments } = config; |
There was a problem hiding this comment.
This config to suppress commenting on Github issues, but rather update the description instead. Prevents constant messaging to external customers when they cannot act on those.
api/actions/createWorkItem.js
Outdated
| }; | ||
| function formatToGus(url, body) { | ||
| var formattedDescription; | ||
| remark().use(markdown).use(strip).process(body, (err, file) => { |
There was a problem hiding this comment.
Strip markdown to GUS format
There was a problem hiding this comment.
This show how this works and I tried with a few github issues from the past and seems to work as expected - http://remarkjs.github.io/strip-markdown/
api/actions/createWorkItem.js
Outdated
| if (err) { | ||
| throw err; | ||
| } | ||
| formattedDescription = 'Github issue link: '.concat(url, '\n', String(file)); |
There was a problem hiding this comment.
Adds the github link at the top of the description. We can make it a table as @reiniergs suggested. But will involve more work and I can take that up after finishing up the changelist sync story I'm currently working.
| }); | ||
| expect(workItemUrl).toBe( | ||
| 'https://gus.lightning.force.com/lightning/r/ADM_Work__c/qwerty1234/view' | ||
| '[W-234123](https://gus.lightning.force.com/lightning/r/ADM_Work__c/qwerty1234/view)' |
There was a problem hiding this comment.
Just a nice a have feature to show linked GUS item as a hyperlink instead of the full URL.
api/actions/createWorkItem.js
Outdated
| } | ||
|
|
||
| async function updateIssue(req, body, suppressGithubComments) { | ||
| if (suppressGithubComments) { |
There was a problem hiding this comment.
Shouldn't this method run updateDescription or createComment depending on suppressGithubComments's value ?
There was a problem hiding this comment.
Yes, that's the intention. It seems to work since suppressGithubComments config is boolean and not a string or is it a better practice to explicitly check the value?
api/actions/createWorkItem.js
Outdated
| issue: { labels, url, title, body, milestone } | ||
| issue: { labels, url, body, milestone } | ||
| } = req.body; | ||
| var { |
There was a problem hiding this comment.
use let here instead of var or I will rather compute a new variable like normalizedTitle and avoid doing mutation
api/actions/createWorkItem.js
Outdated
| return null; | ||
| } | ||
| }; | ||
| function formatToGus(url, body) { |
There was a problem hiding this comment.
please move this function into separate files
api/actions/createWorkItem.js
Outdated
| return formattedDescription; | ||
| } | ||
|
|
||
| async function updateIssue(req, body, suppressGithubComments) { |
There was a problem hiding this comment.
move helper function into separate files
api/actions/createWorkItem.js
Outdated
|
|
||
| async function updateIssue(req, body, suppressGithubComments) { | ||
| if (suppressGithubComments) { | ||
| return await Github.updateDescription({ |
There was a problem hiding this comment.
if suppressGithubComments is true we shouldn't write the comments in the description of the issue, it will be hard to keep in sync/updated the description moving forward. I will say supressGithubComments suppress any communication back to Github
There was a problem hiding this comment.
Let me bring this up with my PM who initially suggested this. FYI @ntotten @smaddox-sf
…ng the updates to description