imjohnbo / issue-bot

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

Ability to skip when previous issue exists #75

Closed Jblew closed 2 years ago

Jblew commented 2 years ago

Hi! I needed a feature that allows skipping issue creation when a previous one exists.

Use case:

  1. Suppose we want to create an issue once a month. Suppose it is a very important issue. Consider that Github Actions Schedule is not a guaranteed to run. Instead we can trigger adding the issue more often but then look up if it already exists.

Example

on:
  schedule:
    - cron: "30 5 * * *" # Every day at 5:30

jobs:
  create-issue:
    runs-on: ubuntu-latest
    steps:
- uses: actions/github-script@v6
  id: since
  with:
    script: |
      const isoYYYYMM = new Date().toISOString().slice(0, 7)
      return { since: `${isoYYYYMM}-10T00:00:00` }
- uses: imjohnbo/issue-bot
  with:
    token: "${{ secrets.GH_PAT }}"
    assignees: "jblew"
    labels: "pay-social-tax"
    title: Pay the social-tax
    skip-on-previous: true
    previous-lookup-since: ${{ steps.since.outputs.results.since }}
    body: |-
      Pay the Social tax... Here is the number...

This way we can easily make sure the issue appears in a repository each 10th day of month.

What do you think of that? I just needed it myself but thought it might be useful so I created a PR 😄 :octocat:

imjohnbo commented 2 years ago

Thanks for the suggestion, @Jblew. I'll politely decline incorporating this feature, since schedule (especially off the hour) should suffice for nearly all use cases. If we see significant community interest, we can consider the idea again. 💖

Jblew commented 2 years ago

Sure :) I'd be very glad if you could get my voice heard at Github: what I'm needing (and perhaps others too) is a reliable schedule cron service. One with decent SLA that could be used to schedule a yearly issues. It is highly useful for a company: automatic e-mail notifications for third party providers, automatic agreement prolongations, etc). Thanks!