Skip to content

Commit b808bfb

Browse files
committed
fix upstream
1 parent 97ba1fb commit b808bfb

3 files changed

Lines changed: 148 additions & 57 deletions

File tree

.github/workflows/upstream-watch.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ concurrency:
1313
group: upstream-watch
1414
cancel-in-progress: false
1515

16+
env:
17+
UPSTREAM_WATCH_STATE_FILE: .cache/upstream-watch/upstream-watch-state.json
18+
1619
jobs:
1720
watch:
1821
runs-on: ubuntu-latest
@@ -26,22 +29,33 @@ jobs:
2629
with:
2730
python-version: "3.12"
2831

32+
- name: Restore upstream watch state cache
33+
id: restore-upstream-watch-state
34+
uses: actions/cache/restore@v4
35+
with:
36+
path: ${{ env.UPSTREAM_WATCH_STATE_FILE }}
37+
key: upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}-${{ github.run_id }}
38+
restore-keys: |
39+
upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}-
40+
41+
- name: Seed upstream watch state
42+
run: |
43+
mkdir -p "$(dirname "${{ env.UPSTREAM_WATCH_STATE_FILE }}")"
44+
if [ ! -f "${{ env.UPSTREAM_WATCH_STATE_FILE }}" ]; then
45+
cp .github/upstream-watch-state.json "${{ env.UPSTREAM_WATCH_STATE_FILE }}"
46+
fi
47+
2948
- name: Validate upstream watch config
3049
run: python3 scripts/upstream_watch.py --validate-config
3150

3251
- name: Run upstream watch
3352
env:
3453
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
run: python3 scripts/upstream_watch.py
54+
run: python3 scripts/upstream_watch.py --state "${{ env.UPSTREAM_WATCH_STATE_FILE }}"
3655

37-
- name: Commit updated watch state
38-
run: |
39-
git config user.name "github-actions[bot]"
40-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
41-
git add .github/upstream-watch-state.json
42-
if git diff --cached --quiet; then
43-
echo "No state changes to commit."
44-
exit 0
45-
fi
46-
git commit -m "chore: refresh upstream watch state"
47-
git push
56+
- name: Save upstream watch state cache
57+
if: always()
58+
uses: actions/cache/save@v4
59+
with:
60+
path: ${{ env.UPSTREAM_WATCH_STATE_FILE }}
61+
key: upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}-${{ github.run_id }}

AGENTS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,20 @@ When adding a documentation watch:
476476
- Watch stable, meaningful overview pages, not random transient pages.
477477
- Prefer official Microsoft Learn URLs that define platform or framework guidance.
478478
- Keep issue fan-out reviewable. Upstream-watch automation must track one open maintenance issue per library or skill group, not one permanently open issue per individual documentation page when those pages roll up to the same library refresh.
479-
- When another upstream change arrives for a library or skill group that already has an open upstream-watch issue, update that existing issue and append the new watch detail instead of creating another open issue.
479+
- When another upstream change arrives for a library or skill group that already has an open upstream-watch issue, carry the pending watch context forward into the replacement issue so the new issue starts with the full current upstream state.
480480
- Upstream-watch issue discovery must paginate across the full matching issue set before deciding whether an issue already exists. Do not assume the first page of GitHub issues is sufficient for deduplication or repair.
481+
- Upstream-watch automation must be issue-driven and must not create `catalog-v*` releases or any other user-facing release noise just because machine-maintained watch state changed.
482+
- Do not commit routine upstream-watch state refreshes to `main`. Persist automation state in a non-release-triggering channel so scheduled watch runs can open or rotate issues without manufacturing empty catalog releases.
483+
- When a new upstream event arrives for a library or skill group that already has an open upstream-watch issue, create a fresh issue for the new event and close the older open issue as superseded by the newer one.
481484

482485
## State File Rules
483486

484487
[`.github/upstream-watch-state.json`](.github/upstream-watch-state.json) is machine-maintained state.
485488

486489
Rules:
487490

491+
- Treat the checked-in `.github/upstream-watch-state.json` file as a bootstrap baseline and local fallback, not as a daily-updated commit log on `main`.
492+
- Scheduled automation may restore and save runtime watch state outside tracked files, but it must not push routine state refresh commits to the default branch.
488493
- Do not hand-edit it unless there is a repository emergency.
489494
- To validate watch config structure without contacting upstream sources, run:
490495

0 commit comments

Comments
 (0)