Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ steps:

### Outputs

If you need the number or URL of the issue that was created for another Action, you can use the `number` or `url` outputs, respectively. For example:
If you need the number or URL of the issue that was created for another Action, you can use the `number` or `url` outputs, respectively. The `node id` is useful if another action uses the [GraphQL API](https://docs.github.com/en/graphql/reference). For example:

```yaml
steps:
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ outputs:
description: Number of the issue that was created
url:
description: URL of the issue that was created
id:
description: node-id of the issue that was created
3 changes: 2 additions & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export type FrontMatterAttributes = z.infer<typeof frontmatterSchema>;

export function setOutputs(
tools: Toolkit,
issue: { number: number; html_url: string }
issue: { number: number; html_url: string; node_id: string }
) {
tools.outputs.number = String(issue.number);
tools.outputs.url = issue.html_url;
tools.outputs.id = issue.node_id;
}

export function listToArray(list?: string[] | string) {
Expand Down
5 changes: 4 additions & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe("create-an-issue", () => {
title: body.title,
number: 1,
html_url: "www",
node_id: "node",
};
});

Expand All @@ -57,9 +58,10 @@ describe("create-an-issue", () => {
expect((tools.log.success as any).mock.calls).toMatchSnapshot();

// Verify that the outputs were set
expect(core.setOutput).toHaveBeenCalledTimes(2);
expect(core.setOutput).toHaveBeenCalledTimes(3);
expect(core.setOutput).toHaveBeenCalledWith("url", "www");
expect(core.setOutput).toHaveBeenCalledWith("number", "1");
expect(core.setOutput).toHaveBeenCalledWith("id", "node");
});

it("creates a new issue from a different template", async () => {
Expand Down Expand Up @@ -143,6 +145,7 @@ describe("create-an-issue", () => {
title: body.title,
number: 1,
html_url: "www",
node_id: "node",
};
});

Expand Down