-
Describe your feature idea In github front end we have an option to change projects notes to issues and it's call Is possible to add a programatic way to do that? I'm developing a new Github App who will manage and add some new features to project board, eg. create a new branch when a card is moved from todo to in progress and then send a email/discord message with commands to user fetch this branch and at the same time "expose" a new work to be done. And another things ... Describe the problem you are facing There is no programatic way to github app change a note to issue as easier than github frontend and without lost user information. Describe the workarounds you tried so far and how they worked for you I'm currently using Probot as Github App, and I'm using this workaround to solve it: app.on("project_card.moved", async (context) => {
const card = (await context.octokit.projects.getCard({ card_id: context.payload.project_card.id })).data
// @ts-ignore
const fron = (await context.octokit.projects.getColumn({ column_id: context.payload.changes.column_id.from })).data
const to = (await context.octokit.projects.getColumn({ column_id: context.payload.project_card.column_id })).data
if (!card.content_url) { // Check if card is an issue
const body: String[] = []
card.note.split('\n').forEach((item, i) => {
if (i !== 0) body.push(item);
})
// create a new issue
const issue = (await context.octokit.issues.create({
owner: context.payload.repository.owner.login,
title: card.note.split('\n')[0],
repo: context.payload.repository.name,
body: body.length > 1 ? body.join("\n") : undefined,
})).data
// create a new card with issue ref
await context.octokit.projects.createCard({
content_type: "Issue",
content_id: issue.id,
column_id: to.id,
})
// delete the old card
await context.octokit.projects.deleteCard({card_id: card.id})
}
} the problem is the issue is now created by the Github App not by the user. So I need to put a "creator" reference in the body of the issue |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There doesn't seem to be a REST API endpoint to convert a project card to an issue, but a GraphQL Mutation: await octokit.graphql(`
mutation ($cardId: ID!, $repositoryId: ID!, $title: String, $body: String) {
convertProjectCardNoteToIssue(input: {projectCardId: $cardId, repositoryId: $repositoryId, title: $title, body: $body}) {
clientMutationId
}
}
`, {
projectCardId: context.payload.project_card.node_id,
repositoryId: context.payload.repository.node_id,
// optional
title: 'new issue title', // defaults to card content
body: 'new issue description'
}) Does that work for you? |
Beta Was this translation helpful? Give feedback.
There doesn't seem to be a REST API endpoint to convert a project card to an issue, but a GraphQL Mutation:
convertProjectCardNoteToIssue
Does that work for you?