Skip to main content

github.github.updateissue

Home > @runlightyear/github > GitHub > updateIssue

GitHub.updateIssue() method

Update an issue

Signature:
updateIssue(props: UpdateIssueProps): Promise<HttpProxyResponse>;

Parameters

ParameterTypeDescription
propsUpdateIssuePropsprops
Returns:

Promise<HttpProxyResponse>

Example 1

Assign an issue

import { defineAction } from "@runlightyear/lightyear";
import { GitHub } from "@runlightyear/github";

defineAction({
name: "assignIssue",
title: "Assign Issue",
apps: ["github"],
variables: [
{
name: "owner",
description:
"The account owner of the repository. The name is not case sensitive.",
},
{
name: "repo",
description:
"The name of the repository without the .git extension. The name is not case sensitive.",
},
"issueNumber",
"assignee",
],
run: async ({ auths, variables }) => {
const github = new GitHub({
auth: auths.github,
});
const result = await github.updateIssue({
owner: variables.owner!,
repo: variables.repo!,
issueNumber: parseInt(variables.issueNumber!),
assignees: [variables.assignee!],
});
console.log("Issue: ", result.data);
},
});

Example 2

Label an issue

import { defineAction } from "@runlightyear/lightyear";
import { GitHub } from "@runlightyear/github";

defineAction({
name: "labelIssue",
title: "Label Issue",
apps: ["github"],
variables: [
{
name: "owner",
description:
"The account owner of the repository. The name is not case sensitive.",
},
{
name: "repo",
description:
"The name of the repository without the .git extension. The name is not case sensitive.",
},
"issueNumber",
"label",
],
run: async ({ auths, variables }) => {
const github = new GitHub({
auth: auths.github,
});
const response = await github.updateIssue({
owner: variables.owner!,
repo: variables.repo!,
issueNumber: parseInt(variables.issueNumber!),
labels: [variables.label!],
});
console.log("Response: ", response.data);
},
});

Example 3

Complete an issue

import { defineAction } from "@runlightyear/lightyear";
import { GitHub } from "@runlightyear/github";

defineAction({
name: "completeIssue",
title: "Complete Issue",
apps: ["github"],
variables: [
{
name: "owner",
description:
"The account owner of the repository. The name is not case sensitive.",
},
{
name: "repo",
description:
"The name of the repository without the .git extension. The name is not case sensitive.",
},
"issueNumber",
],
run: async ({ auths, variables }) => {
const github = new GitHub({
auth: auths.github,
});
const response = await github.updateIssue({
owner: variables.owner!,
repo: variables.repo!,
issueNumber: parseInt(variables.issueNumber!),
state: "closed",
stateReason: "completed",
});
console.log("Response: ", response.data);
},
});