discourse/spec/script
Martin Brennan d9359c1256
DEV: Automatic upcoming change status report and PR creation (#40291)
Introduces a [scheduled
workflow](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#schedule)
that runs weekly to find upcoming changes which
have not changed status in the 14+ days. If found, the following
happens:

* A branch for the bump is made, which is used as a unique key to avoid
   duplicate PRs
* The status change is made in the relevant settings.yml file
* A commit & PR is made for the bump, and it is assigned to the
   person who originally introduced the upcoming change

The status report & script used by the workflow can be called in a dry
run, which will give an output of the actions that will be taken by the
workflow. Here is how to run the report:

```bash
SKIP_DB_AND_REDIS=1 RAILS_DB=nonexistent bin/rails runner script/upcoming_changes_status_report -- --stale-after-days 14 --pretty > /tmp/upcoming_changes_status_report.json
```

An example of the report output:

```json
{
    "name": "ai_bot_enable_docked_composer",
    "settings_path": "plugins/discourse-ai/config/settings.yml",
    "current_status": "alpha",
    "next_status": "beta",
    "eligible": true,
    "eligibility_reason": "status_unchanged_for_14_days",
    "days_since_status_change": 22,
    "last_status_change_commit": "b3b561e5fa",
    "last_status_change_date": "2026-05-04T09:26:32-07:00",
    "original_commit": "b3b561e5fa",
    "original_commit_date": "2026-05-04T09:26:32-07:00",
    "original_author_name": "Keegan George",
    "original_author_email": "kgeorge13@gmail.com",
    "original_pr_number": "39708"
},
```

And here is the result of a dry run of the script (it prints out this
set of commands
for every upcoming change that will be bumped). The dry run command:

```bash
REPORT_FILE=/tmp/upcoming_changes_status_report.json BASE_BRANCH=main DRY_RUN=true STALE_AFTER_DAYS=14 script/create_upcoming_change_status_prs
```

And the result:

```bash
git checkout -B dev/upcoming-change-status-bump/simple_email_subject origin/main
SKIP_DB_AND_REDIS=1 RAILS_DB=nonexistent bin/rails runner script/upcoming_changes_status_report -- --stale-after-days 14 --apply simple_email_subject
git add config/site_settings.yml
git commit -m "DEV: Bump simple_email_subject upcoming change to beta"
git push -f origin dev/upcoming-change-status-bump/simple_email_subject
gh pr create --base main --head dev/upcoming-change-status-bump/simple_email_subject --title "DEV: Bump simple_email_subject upcoming change to beta" --body-file /tmp/upcoming-change-simple_email_subject-body.md --label upcoming-change --assignee dbattersby
```

And here is an example of the body of the PR:

```markdown
<!-- upcoming-change-status-pr:simple_email_subject -->

This automated PR moves `simple_email_subject` from `alpha` to `beta` after 14+ days without a status change.

- Last status change commit: [`695b393dac0ee829f12d54ba741f847c0621980d`](695b393dac)
- Last status change date: `2026-05-07T12:58:02+04:00`
- Settings file: `config/site_settings.yml`
- Original author: David Battersby (<info@davidbattersby.com>)
- Original PR: #36040
```
2026-06-11 15:19:15 +10:00
..
import_scripts
create_upcoming_change_status_prs_spec.rb DEV: Automatic upcoming change status report and PR creation (#40291) 2026-06-11 15:19:15 +10:00
upcoming_changes_status_report_spec.rb DEV: Automatic upcoming change status report and PR creation (#40291) 2026-06-11 15:19:15 +10:00