@@ -2,14 +2,18 @@ name: Update What's New
22
33on :
44 schedule :
5- # Review the previous 30 complete UTC days every day at 06:00 UTC.
5+ # Review new merges and expire old highlights every day at 06:00 UTC.
66 - cron : " 0 6 * * *"
77 workflow_dispatch :
88 inputs :
99 dry-run :
1010 description : " Propose highlights without opening a pull request"
1111 type : boolean
1212 default : false
13+ full-rescan :
14+ description : " Re-evaluate every pull request in the 30-day window"
15+ type : boolean
16+ default : false
1317
1418permissions :
1519 contents : write
4044 echo "start=$(date -u -d "$PERIOD_END - 29 days" +%F)" >> "$GITHUB_OUTPUT"
4145 echo "end=$PERIOD_END" >> "$GITHUB_OUTPUT"
4246
47+ - name : Restore curator state
48+ uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
49+ with :
50+ path : ${{ runner.temp }}/whats-new-state.json
51+ key : whats-new-state-${{ github.repository }}-${{ github.run_id }}
52+ restore-keys : |
53+ whats-new-state-${{ github.repository }}-
54+
4355 - name : Configure AWS credentials
4456 id : aws-credentials
4557 continue-on-error : true
@@ -68,16 +80,47 @@ jobs:
6880 git show "origin/$BRANCH_NAME:data/whats-new.json" > data/whats-new.json
6981 fi
7082
83+ - name : Set review mode and checkpoint
84+ id : review
85+ env :
86+ FULL_RESCAN : ${{ inputs.full-rescan == true }}
87+ PERIOD_END : ${{ steps.period.outputs.end }}
88+ STATE_FILE : ${{ runner.temp }}/whats-new-state.json
89+ run : |
90+ REVIEWED_THROUGH=$(jq -r '.reviewed_through // empty' "$STATE_FILE" 2>/dev/null || true)
91+ if ! [[ "$REVIEWED_THROUGH" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
92+ REVIEWED_THROUGH=$(jq -r '.period_end' data/whats-new.json)
93+ fi
94+ DATA_PERIOD_END=$(jq -r '.period_end' data/whats-new.json)
95+ if [[ "$DATA_PERIOD_END" > "$REVIEWED_THROUGH" ]]; then
96+ REVIEWED_THROUGH=$DATA_PERIOD_END
97+ fi
98+
99+ if [ "$FULL_RESCAN" = "true" ]; then
100+ MODE=full
101+ else
102+ MODE=incremental
103+ fi
104+
105+ jq -n --arg reviewed_through "$PERIOD_END" \
106+ '{reviewed_through: $reviewed_through}' > "$STATE_FILE"
107+
108+ {
109+ echo "mode=$MODE"
110+ echo "reviewed-through=$REVIEWED_THROUGH"
111+ } >> "$GITHUB_OUTPUT"
112+
71113 - name : Curate highlights
72114 uses : docker/docker-agent-action@e96a4bb40cac114f64358621e1d08346c8eadc8c # v2.0.1
73115 env :
74116 GH_TOKEN : ${{ env.GITHUB_APP_TOKEN || github.token }}
75117 with :
76118 agent : ${{ github.workspace }}/.github/agents/whats-new.yaml
77119 prompt : >-
78- Use the curate-whats-new skill to review documentation pull requests merged from
79- ${{ steps.period.outputs.start }} through
80- ${{ steps.period.outputs.end }}, inclusive.
120+ Use the curate-whats-new skill in ${{ steps.review.outputs.mode }} mode.
121+ The publication window is ${{ steps.period.outputs.start }} through
122+ ${{ steps.period.outputs.end }}, inclusive. The last successful incremental
123+ review covered through ${{ steps.review.outputs.reviewed-through }}.
81124 anthropic-api-key : ${{ secrets.ANTHROPIC_API_KEY }}
82125 github-token : ${{ env.GITHUB_APP_TOKEN || github.token }}
83126 timeout : 1200
@@ -158,3 +201,10 @@ jobs:
158201 --base main \
159202 --head "$BRANCH_NAME"
160203 fi
204+
205+ - name : Save curator state
206+ if : success() && inputs.dry-run != true && steps.changes.outputs.changed != 'true'
207+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
208+ with :
209+ path : ${{ runner.temp }}/whats-new-state.json
210+ key : whats-new-state-${{ github.repository }}-${{ github.run_id }}
0 commit comments