imjohnbo / issue-bot

GitHub Actions powered Issue Bot 🦾
https://github.com/imjohnbo/issue-bot
MIT License
101 stars 31 forks source link

Suggestion: Conditional opening #90

Closed wiegell closed 11 months ago

wiegell commented 1 year ago

A suggestion: I only wan't to open an issue, if there is not already an issue with the same title. I'm aware of the close-previous functionality, but i want to preserve history on an existing issue. My usecase is output from trivy.

imjohnbo commented 1 year ago

Thanks for the feature request @wiegell. Issue Bot is good at creating new issues but doesn't yet support commenting on existing issues.

What kind of API would make sense to you? How would you want to call this from a workflow? I'm wondering if an upstream action could be built to retrieve an issue on certain conditions like matching title, matching labels, etc. This issue could output an issue number, which Issue Bot would accept as a new input. The presence of this input would signal issue commenting instead of issue creation.

e.g. this would find the most recent issue whose title is "Hello, world", assign it to octocat and monalisa, pin it, and fill out the template comment, Hi, {{#each assignees}}@{{this}}{{#unless @last}}, {{/unless}}{{/each}}!.

- name: Comment on existing issue
  id: comment-on-existing-issue
  uses: imjohnbo/find-issue-this-action-doesn't-exist-yet@v1
  with:
    title: Hello, world

- name: Comment on existing issue
  uses: imjohnbo/issue-bot@v4
  env:
    ISSUE_NUMBER: ${{ steps.comment-on-existing-issue.outputs.number }}
  with:
    assignees: "octocat, monalisa"
    issue-number-for-commenting: ${{ env.ISSUE_NUMBER }}
    body: |-
      :wave: Hi, {{#each assignees}}@{{this}}{{#unless @last}}, {{/unless}}{{/each}}!
    pinned: true
wiegell commented 1 year ago

Commenting would also be cool, but basically what i wanted was to just update the original post, if a post with the same title already exists something like this:

- name: Create new issue
  uses: imjohnbo/issue-bot@v3
  with:
    assignees: "octocat, monalisa"
    title: Hello, world
    update: true
    body: |-
      :wave: Hi, {{#each assignees}}@{{this}}{{#unless @last}}, {{/unless}}{{/each}}!

Under the hood the action would need to first do a request to search for issues with this title and if found get the issue number

Abhijeet-Pubba commented 1 year ago

Hey is this request in progress as I am awaiting for the same feature. If this is in progress when can we have this new feature

imjohnbo commented 1 year ago

Hey is this request in progress as I am awaiting for the same feature. If this is in progress when can we have this new feature

Hey nope it's not in progress (yet?). PRs are welcome though!

github-actions[bot] commented 1 year ago

Beep boop! 🤖 This issue hasn't had any activity in a while. I'll close it if I don't hear back soon.

github-actions[bot] commented 1 year ago

Beep boop! 🤖 This issue hasn't had any activity in a while. I'll close it if I don't hear back soon.

github-actions[bot] commented 1 year ago

Beep boop! 🤖 This issue hasn't had any activity in a while. I'll close it if I don't hear back soon.

CoMPaTech commented 11 months ago

@imjohnbo would this still be viable?