Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output Project V2 Issue Item ID #79

Merged
merged 1 commit into from
Oct 8, 2022
Merged
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ linked-comments-previous-issue-text:::optional-->action(Issue Bot Action):::acti
rotate-assignees:::optional-->action(Issue Bot Action):::action
action(Issue Bot Action)-->issue-number:::output
action(Issue Bot Action)-->previous-issue-number:::output
action(Issue Bot Action)-->project-v2-issue-item-id:::output
classDef required fill:#6ba06a,stroke:#333,stroke-width:3px
classDef optional fill:#d9b430,stroke:#333,stroke-width:3px
classDef action fill:blue,stroke:#333,stroke-width:3px,color:#ffffff
Expand All @@ -107,6 +108,7 @@ click linked-comments-previous-issue-text "https://github.com/imjohnbo/issue-bot
click rotate-assignees "https://github.com/imjohnbo/issue-bot/blob/main/action.yml#L96"
click issue-number "https://github.com/imjohnbo/issue-bot/blob/main/action.yml#L104"
click previous-issue-number "https://github.com/imjohnbo/issue-bot/blob/main/action.yml#L107"
click project-v2-issue-item-id "https://github.com/imjohnbo/issue-bot/blob/main/action.yml#L117"
```
<!-- END MERMAID -->

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ outputs:
previous-issue-number:
description: 'The issue number of the previous issue, if available'

project-v2-issue-item-id:
description: 'The issue item id of the Projects v2, if available'
runs:
using: 'node12'
main: 'dist/index.js'
9 changes: 8 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/issue-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ const run = async (inputs) => {
core.info(`Running with inputs: ${JSON.stringify(inputs)}`);

let previousAssignee; let previousIssueNumber = -1; let previousIssueNodeId; let previousAssignees;
let projectV2IssueItemId;

if (needPreviousIssue(inputs.pinned, inputs.closePrevious, inputs.rotateAssignees, inputs.linkedComments)) {
({ previousIssueNumber, previousIssueNodeId, previousAssignees } = await getPreviousIssue(inputs.labels));
Expand All @@ -415,10 +416,11 @@ const run = async (inputs) => {
}

if (inputs.projectV2) {
await addIssueToProjectV2({
const response = await addIssueToProjectV2({
issueNodeId: newIssueNodeId,
url: inputs.projectV2
});
projectV2IssueItemId = response.addProjectV2ItemById.item.id;
}

if (inputs.milestone) {
Expand Down Expand Up @@ -463,6 +465,11 @@ const run = async (inputs) => {
core.info(`Previous issue number: ${previousIssueNumber}`);
core.setOutput('previous-issue-number', String(previousIssueNumber));
}

if (projectV2IssueItemId) {
core.info(`Project V2 Issue Item Id: ${projectV2IssueItemId}`);
core.setOutput('project-v2-issue-item-id', projectV2IssueItemId);
}
} catch (error) {
core.setFailed(`Error encountered: ${error}.`);
}
Expand Down