ci(digest): close existing open digest PRs before creating new one (#42)

Problem: if a digest PR is not merged before the next weekly run, a
second PR is created for the same items plus any new ones, leading
to duplicate open PRs.

Solution: before fetching upstream activity, close any open PRs
labeled upstream/digest (deleting their branches). The new run
re-fetches all items since the last merged baseline and produces a
single up-to-date PR.
This commit is contained in:
Barrett Ruth 2026-03-03 14:59:08 -05:00 committed by GitHub
parent 56d1745415
commit 61e84bbc5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,20 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Close existing digest PRs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr list \
--repo barrettruth/canola.nvim \
--label "upstream/digest" \
--state open \
--json number \
--jq '.[].number' \
| xargs -r -I{} gh pr close {} \
--repo barrettruth/canola.nvim \
--delete-branch
- name: Update upstream tracker
id: digest
env:
@ -42,5 +56,6 @@ jobs:
--title "docs(upstream): add digest for week of ${DATE}" \
--body "Automated weekly digest of new upstream activity. Triage by updating statuses and notes." \
--base main \
--head "${BRANCH}")
--head "${BRANCH}" \
--label "upstream/digest")
gh pr merge "${PR_URL}" --auto --squash