Skip to content

Commit 851e5dc

Browse files
Copilotmrjf
andcommitted
feat: run wiki writer on daily schedule instead of closed PRs
Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent 2fd32d3 commit 851e5dc

2 files changed

Lines changed: 48 additions & 23 deletions

File tree

docs/agentic-wiki-writer.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
**Automatically generates and maintains GitHub wiki pages from your source code**
66

7-
The [Agentic Wiki Writer workflow](../workflows/agentic-wiki-writer.md?plain=1) keeps your project's GitHub wiki synchronized with the codebase. After each merged pull request (or on demand), it reads a `PAGES.md` template to understand what to document, then writes wiki pages directly from the source code.
7+
The [Agentic Wiki Writer workflow](../workflows/agentic-wiki-writer.md?plain=1) keeps your project's GitHub wiki synchronized with the codebase. Once a day (if any pull requests were merged to the default branch), it reads a `PAGES.md` template to understand what to document, then writes wiki pages directly from the source code. You can also trigger it manually on demand.
88

99
> [!WARNING]
1010
> **The repository wiki must be initialized before running this workflow.** GitHub does not create the wiki git repository until at least one page exists. Go to your repository's **Wiki** tab and create a blank page (e.g. "Home") to initialize it. The workflow will fail with a git clone error if this step is skipped.
@@ -25,18 +25,20 @@ This walks you through adding the workflow to your repository.
2525

2626
```mermaid
2727
graph LR
28-
A[PR merged / manual trigger] --> B{PAGES.md exists?}
29-
B -->|No| C[Generate PAGES.md template]
30-
B -->|Yes| D[Read PAGES.md template]
31-
C --> E[Save template to .github/agentic-wiki/]
32-
D --> F[Identify changed files from PR]
33-
F --> G[Read relevant source files]
34-
G --> H[Write wiki pages]
35-
H --> I[Push wiki pages]
36-
I --> J[Create PR if source changes needed]
28+
A[Daily schedule / manual trigger] --> B{Any merges today?}
29+
B -->|No| C[Skip - no wiki update needed]
30+
B -->|Yes| D{PAGES.md exists?}
31+
D -->|No| E[Generate PAGES.md template]
32+
D -->|Yes| F[Read PAGES.md template]
33+
E --> G[Save template to .github/agentic-wiki/]
34+
F --> H[Identify changed files from recent merges]
35+
H --> I[Read relevant source files]
36+
I --> J[Write wiki pages]
37+
J --> K[Push wiki pages]
38+
K --> L[Create PR if source changes needed]
3739
```
3840

39-
On the first run (or when `regenerate-template` is enabled), the workflow generates a `PAGES.md` template describing the wiki structure it will maintain. On subsequent runs it follows the template — reading only the source files relevant to the merged PR, then writing updated wiki content.
41+
On the first run (or when `regenerate-template` is enabled), the workflow generates a `PAGES.md` template describing the wiki structure it will maintain. On subsequent runs it follows the template — reading only the source files relevant to the recently merged PRs, then writing updated wiki content.
4042

4143
### Key Features
4244

@@ -52,12 +54,34 @@ Trigger the workflow manually with `regenerate-template: true` to create the ini
5254

5355
### Configuration
5456

55-
The workflow triggers automatically on every merged PR to the default branch. You can also trigger it manually from the Actions tab:
57+
The workflow runs once a day (at midnight UTC) and checks whether any pull requests were merged to the default branch in the last 24 hours. If no merges happened, it exits early with no work done. You can also trigger it manually from the Actions tab.
5658

57-
- **`regenerate-template`** (`boolean`, default `false`) — Set to `true` to rebuild the `PAGES.md` template from scratch.
59+
You can adjust the cadence or event structure to suit your team's workflow. For example, to run on every push to the default branch instead of on a schedule, replace the `schedule: daily` trigger with:
60+
61+
```yaml
62+
on:
63+
push:
64+
branches: [main]
65+
workflow_dispatch:
66+
...
67+
```
68+
69+
Or to run twice a day, change the schedule to:
70+
71+
```yaml
72+
on:
73+
schedule:
74+
- cron: "0 6,18 * * *"
75+
workflow_dispatch:
76+
...
77+
```
5878
5979
After editing the workflow file, run `gh aw compile` to update the compiled workflow and commit all changes to the default branch.
6080

81+
Available inputs for manual dispatch:
82+
83+
- **`regenerate-template`** (`boolean`, default `false`) — Set to `true` to rebuild the `PAGES.md` template from scratch.
84+
6185
## PAGES.md Format
6286

6387
The `PAGES.md` file at `.github/agentic-wiki/PAGES.md` is the single source of truth for your wiki structure. It is generated automatically on the first run and saved as a PR for you to review. After that, you can edit it freely to customize your documentation structure. You can also supply a `PAGES.md` yourself before the first run to pre-define the structure.

workflows/agentic-wiki-writer.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
name: Agentic Wiki Writer
33
description: >
44
Generates GitHub wiki pages from source code using a PAGES.md template.
5-
Runs on PR merge or manual dispatch with agent-driven triage.
5+
Runs once a day if any merges to the default branch have happened, or on manual dispatch.
66
on:
77
workflow_dispatch:
88
inputs:
99
regenerate-template:
1010
description: "Regenerate PAGES.md from scratch (full regen)"
1111
type: boolean
1212
default: false
13-
pull_request:
14-
types: [closed]
15-
branches: [main]
13+
schedule: daily
1614
permissions:
1715
contents: read
1816
issues: read
@@ -119,19 +117,22 @@ You have persistent storage that survives across runs. To find the path, run `ls
119117
2. **Read memory files** from that directory before starting work.
120118
3. **After finishing**, use the `write` tool to save updated memory files to the same directory.
121119

122-
## Step 0: Triage (PR merge triggers only)
120+
## Step 0: Triage (scheduled triggers only)
123121

124122
If this workflow was triggered by `workflow_dispatch`, **skip this step entirely** — always proceed to Step 1.
125123

126-
If this workflow was triggered by a `pull_request` event, you must first check that the PR was actually merged (not just closed), then determine whether the changes are likely to affect wiki documentation.
124+
If this workflow was triggered by the `schedule` event, check whether any pull requests have been merged into the default branch in the last 24 hours. If none have been merged, there is nothing to document — call the `noop` safe-output with "No merges to the default branch in the last 24 hours" and **stop**.
127125

128-
### 0a. Check if PR was merged
126+
### 0a. Check for recent merges
129127

130-
Use the GitHub tools to inspect the pull request that triggered this run. If the PR was **closed without merging**, call the `noop` safe-output with "PR was closed without merging" and **stop**.
128+
Use the GitHub tools to list recently merged pull requests. Look for any PRs merged into the default branch within the past 24 hours.
129+
130+
- If **no PRs were merged** in the last 24 hours → call the `noop` safe-output and **stop**.
131+
- If **one or more PRs were merged** → continue to step 0b.
131132

132133
### 0b. Identify what changed
133134

134-
Look at the files changed in the merged PR. Use the GitHub tools to list the PR's changed files.
135+
Collect the files changed across all PRs merged into the default branch in the last 24 hours. Use the GitHub tools to list the changed files for each merged PR.
135136

136137
### 0c. Load source map from memory
137138

@@ -151,7 +152,7 @@ Use your judgment. If you're unsure whether a change affects the wiki, err on th
151152

152153
### 0e. Decision
153154

154-
- If **no wiki update needed** → call the `noop` safe-output with a message explaining why (e.g., "PR only modified test files — no wiki impact") and **stop**.
155+
- If **no wiki update needed** → call the `noop` safe-output with a message explaining why (e.g., "Merged PRs only modified test files — no wiki impact") and **stop**.
155156
- If **wiki update needed** → proceed to **Step 1**.
156157

157158
## Step 1: Check for PAGES.md

0 commit comments

Comments
 (0)