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:
- Add the
scheduled-issuelabel to the issue - 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
scheduledordelayedproperties, it adds thescheduled-issuelabel and closes the issue - Reopening scheduled issues: Every hour (or when manually triggered), it checks for closed issues with the
scheduled-issuelabel 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 caseHow It Works
- When a new issue is opened, the action checks the issue body for YAML front-matter
- If front-matter is found, it looks for
delayedand/orscheduledproperties - If either property exists:
- The
scheduled-issuelabel is added to the issue - The issue is closed
- The
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:
- When an issue is opened: The action checks for front-matter and processes the issue
- 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-15or2025-01-15T10:30:00Z) when the issue should be openedrepo(optional): Target repository inowner/repoformat. Defaults to this repository.issue(optional): Target issue number. Defaults to the current issue number.
What happens when the scheduled date arrives:
- The action finds all closed issues in this repository with the
scheduled-issuelabel and front-matter - For issues where the
scheduledordelayeddate has passed:- Removes the front-matter from the issue body
- Removes the
scheduled-issuelabel - 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