Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/merge-schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Scheduled Merge

# Enables scheduling a PR merge by adding `/schedule YYYY-MM-DD` to the PR body.
# The PR must already be approved; this workflow only enables auto-merge, which
# then goes through the normal merge queue like any other PR.
#
# Usage: add this line anywhere in the PR description:
# /schedule 2026-05-15
#
# Runs daily at 9–10am Eastern (10am EDT / 9am EST). Use workflow_dispatch to trigger immediately.

on:
schedule:
- cron: '0 14 * * *' # 10am EDT / 9am EST
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
merge-scheduled-prs:
runs-on: ubuntu-latest
steps:
- name: Merge scheduled PRs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
TODAY=$(TZ='America/New_York' date +%Y-%m-%d)
echo "Today (Eastern): $TODAY"

pr_numbers=$(
gh pr list --repo "$REPO" --state open --json number,body \
--jq '[.[] | select(.body | test("/schedule [0-9]{4}-[0-9]{2}-[0-9]{2}"))] | .[].number'
)

if [[ -z "$pr_numbers" ]]; then
echo "No scheduled PRs found."
exit 0
fi

for pr in $pr_numbers; do
body=$(gh pr view "$pr" --repo "$REPO" --json body --jq '.body')
scheduled=$(printf '%s' "$body" | grep -oP '(?<=/schedule )[0-9]{4}-[0-9]{2}-[0-9]{2}' | head -1)

[[ -z "$scheduled" ]] && continue

echo "PR #$pr is scheduled for $scheduled"

if [[ "$scheduled" > "$TODAY" ]]; then
echo " Not yet due, skipping."
continue
fi

echo " Enabling auto-merge..."
if gh pr merge "$pr" --repo "$REPO" --auto --squash; then
echo " Done."
gh pr comment "$pr" --repo "$REPO" \
--body "Scheduled merge for \`$scheduled\` — added to the merge queue."
else
echo " Warning: could not enable auto-merge."
gh pr comment "$pr" --repo "$REPO" \
--body ":warning: Scheduled merge for \`$scheduled\` could not be enabled. Please check that the PR has the required approvals."
fi
done
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ tags: ["tag1", "tag2", "etc"]

Use **US spelling** throughout (`color` not `colour`, `organized` not `organised`). This applies regardless of the author's locale — consistency across posts matters more than author preference.

**Scheduling a publish date** — if you want to delay merging until a specific date, optionally add this line anywhere in the PR description:

```text
/schedule 2026-05-15
```

The PR must be approved before the scheduled date; the workflow runs daily at ~9am Eastern and will add the PR to the merge queue when the date arrives.

Verify with `npm run build` — no config changes or code edits needed.

## 9. Common Issues
Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ There are two distinct ways to contribute:
5. Open a PR against `main` on this repository. A member of the
**mellea-maintainers** team must approve the PR before it can be merged.

To delay merging until a specific publish date, optionally add this line anywhere in the PR description:

```text
/schedule 2026-05-15
```

The PR must be approved before the scheduled date. A workflow runs daily at ~9am Eastern and will add the PR to the merge queue automatically when the date arrives.

6. Once merged, the CI pipeline builds and deploys the site automatically —
your post will be live at `mellea.ai/blogs/your-slug` within a few minutes.

Expand Down
Loading