GitHunt
BI

BigAB/scheduled-issues

An experiment to see if I can schedule GitHub issues to appear at a later date

scheduled-issues

An experiment to see if I can schedule GitHub issues to appear at a later date

Overview

This action automatically detects when an issue is created with YAML front-matter in its body. If the front-matter contains a delayed or scheduled property, the action will:

  1. Add the scheduled-issue label to the issue
  2. Close the issue

Usage

Setup

Add this workflow to your repository at .github/workflows/scheduled-issues.yml:

name: Scheduled Issues

on:
  issues:
    types: [opened]
  schedule:
    # Run every hour
    - cron: '0 * * * *'
  workflow_dispatch:  # Allow manual trigger for testing

permissions:
  issues: write
  contents: read

jobs:
  process-scheduled-issue:
    runs-on: ubuntu-latest
    if: github.event_name == 'issues'
    steps:
      - name: Process scheduled issue
        uses: BigAB/scheduled-issues@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

  reopen-scheduled-issues:
    runs-on: ubuntu-latest
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    steps:
      - name: Reopen scheduled issues
        uses: BigAB/scheduled-issues/reopen@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

This single workflow file handles both:

  • Processing new issues: When an issue is opened with front-matter containing scheduled or delayed properties, it adds the scheduled-issue label and closes the issue
  • Reopening scheduled issues: Every hour (or when manually triggered), it checks for closed issues with the scheduled-issue label and reopens them when their scheduled date arrives

Creating a Scheduled Issue

Create an issue with front-matter at the beginning of the body:

---
scheduled: 2025-01-15T10:00:00Z
---

# My Scheduled Issue

This issue should appear on January 15th, 2025 at 10:00 AM UTC.

Or with a delayed property:

---
delayed: 7d
---

# My Delayed Issue

This issue should appear 7 days from now.

Both properties can be used at once but delayed will take precedence:

---
scheduled: 2025-01-15T10:00:00Z
delayed: 7d
---

# My Issue

This issue has both `scheduled` and `delayed` properties but `scheduled` will be ignored in this case

How It Works

  1. When a new issue is opened, the action checks the issue body for YAML front-matter
  2. If front-matter is found, it looks for delayed and/or scheduled properties
  3. If either property exists:
    • The scheduled-issue label is added to the issue
    • The issue is closed

How this repository works

This repository uses a single GitHub Action workflow that handles both processing new scheduled issues and reopening them when their scheduled date arrives.

Workflow Triggers

The workflow runs in two scenarios:

  1. When an issue is opened: The action checks for front-matter and processes the issue
  2. Every hour (or manually): The action checks for closed issues that are ready to be reopened

Manually Creating a Scheduled Issue

To manually schedule an issue, create a closed issue with the scheduled-issue label and YAML front-matter in the body:

---
scheduled: 2025-01-15
repo: owner/repository
issue: 123
---

This is the issue content that will appear when the scheduled date arrives.

Note: Make sure to add the scheduled-issue label to the issue, as the action only processes closed issues with this label.

Front-matter properties:

  • scheduled (required): Date string (e.g., 2025-01-15 or 2025-01-15T10:30:00Z) when the issue should be opened
  • repo (optional): Target repository in owner/repo format. Defaults to this repository.
  • issue (optional): Target issue number. Defaults to the current issue number.

What happens when the scheduled date arrives:

  1. The action finds all closed issues in this repository with the scheduled-issue label and front-matter
  2. For issues where the scheduled or delayed date has passed:
    • Removes the front-matter from the issue body
    • Removes the scheduled-issue label
    • Reopens the issue

Manual trigger

You can manually trigger the workflow from the Actions tab to immediately check for scheduled issues that are ready to be reopened.

Contributing

See CONTRIBUTING.md for development setup and testing instructions.

License

MIT

BigAB/scheduled-issues | GitHunt