From 61e84bbc5f995543e5333b4d923944375edeccac Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:59:08 -0500 Subject: [PATCH] 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. --- .github/workflows/upstream-digest.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upstream-digest.yml b/.github/workflows/upstream-digest.yml index a70ee5b..533b0b3 100644 --- a/.github/workflows/upstream-digest.yml +++ b/.github/workflows/upstream-digest.yml @@ -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