Skip to content

Instantly share code, notes, and snippets.

@kutakmir
Created January 13, 2019 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kutakmir/5376f19bc9e34bea9cfcb875a0f4c0b9 to your computer and use it in GitHub Desktop.
Save kutakmir/5376f19bc9e34bea9cfcb875a0f4c0b9 to your computer and use it in GitHub Desktop.
Bugsee Jira integration - recipe that works!
function create(context) {
const issue = context.issue;
const platform = context.platform;
const device = context.device;
const app = context.app;
let description = issue.description || '';
if (description) {
// Add two newlines to separate other data from the description
description += '\n\n';
}
if (issue.reporter) {
description += `Reported by ${issue.reporter}\n`;
}
description += `View full Bugsee session at: ${issue.url}`;
return {
summary: `${issue.key}: ${issue.summary || 'No summary'} [Bugsee]`,
description: description,
labels : ['bugsee'],
custom: {
// Place any custom fields here, refer to a specific
// service documentation for available options.
// https://docs.bugsee.com/integrations/
}
};
}
function update(context, changes) {
const issue = context.issue;
const platform = context.platform;
const device = context.device;
const app = context.app;
const result = {};
if (changes.description) {
let description = changes.description.to || '';
if (description) {
// Add two newlines to separate other data from the description
description += '\n\n';
}
if (issue.reporter) {
description += `Reported by ${issue.reporter}\n`;
}
description += `View full Bugsee session at: ${issue.url}`;
result.description = description;
}
if (changes.summary) {
result.summary = `${issue.key}: ${changes.summary.to || 'No summary'} [Bugsee]`;
}
if (changes.state) {
// Override state with a specific value, otherwise it will be mapped
// automatically from Bugsee issue state ('open', 'closed')
// result.state = 'completed';
}
return {
issue: {
custom: {
// Optional
}
},
changes: result
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment