Skip to content

Commit

Permalink
Add project-v2-issue-item-id
Browse files Browse the repository at this point in the history
  • Loading branch information
parroty committed Oct 6, 2022
1 parent f302da9 commit c4fc1f7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
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

0 comments on commit c4fc1f7

Please sign in to comment.