influxdata / influxdata/docs-v2

cleanup-ephemeral-docs workflow: auto-merge disabled at repo level + duplicate PRs per merge

Open
#7,257 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
82
Forks
326
Avg merge
1d 1h
Merged PRs (30d)
82

Description

## Summary

The `Cleanup ephemeral docs` workflow (`.github/workflows/cleanup-ephemeral-docs.yml`) successfully detects `PLAN.md`/`HANDOVER.md` on `master` and creates cleanup PRs, but those PRs accumulate unmerged because:

1. **Auto-merge is disabled at the repository level.** The workflow calls `gh pr merge --auto --squash --delete-branch`, which fails with `GraphQL: Auto merge is not allowed for this repository (enablePullRequestAutoMerge)`. The workflow logs the failure and continues, leaving the cleanup PR open for manual merge — which is rarely done.
2. **The workflow fires twice on every squash merge** — once for `pull_request_target.closed`, once for `push` to `master` — producing two near-identical cleanup PRs per upstream merge.

## Evidence

**Auto-merge failure** — from the run that fired after PR #7252 merged:

```
gh pr merge "$PR_URL" --auto --squash --delete-branch || echo "Auto-merge not available, PR requires manual merge"
...
GraphQL: Auto merge is not allowed for this repository (enablePullRequestAutoMerge)
Auto-merge not available, PR requires manual merge
Cleanup PR created and auto-merge enabled
```

(The trailing "auto-merge enabled" log line is misleading — `||` swallows the failure.)

**Run:** https://github.com/influxdata/docs-v2/actions/runs/26246670604

**Currently-open cleanup PRs awaiting manual merge:**

| PR | Created | Upstream trigger |
|---|---|---|
| #7255 | 2026-05-21 18:56 UTC | merge of #7252 (push event) |
| #7254 | 2026-05-21 18:56 UTC | merge of #7252 (pull_request_target event) |
| #7226 | 2026-05-15 17:02 UTC | unknown upstream merge |
| #7224 | 2026-05-15 16:04 UTC | unknown upstream merge |
| #7223 | 2026-05-15 15:53 UTC | unknown upstream merge |

Five open cleanup PRs across two days, each holding back a one-line deletion. `PLAN.md` is still on `master` from the most recent merge.

## Fix options

**For the auto-merge failure:**

- **Option A — Enable auto-merge in repo settings** (Settings → General → Pull Requests → "Allow auto-merge"). One-time fix; the existing workflow then works as designed. Lowest blast radius.
- **Option B — Switch to immediate squash merge with admin permission.** Replace `--auto` with `--admin --squash`. Requires the workflow's `GITHUB_TOKEN` (or a PAT) to have permission to bypass branch protection. Higher blast radius, but no manual setting toggle needed.
- **Option C — Skip the cleanup PR entirely; push the deletion commit directly.** Requires either disabling branch protection for the workflow's bot identity, or a separate admin token. Same trust trade-off as Option B.

Option A is the recommended path.

**For the duplicate-PR problem:**

- Drop the `push` trigger and rely only on `pull_request_target.closed`. Squash merges produce both events, so picking one is sufficient; `pull_request_target` is the more reliable source (it has access to the source-PR number for the preservation comment).
- Keep the `push` trigger as a backstop only for direct pushes to `master` — but gate on `github.event.head_commit.author.email != github.actions[bot]@users.noreply.github.com` to avoid feedback loops.

## Cleanup tasks (separate from this fix)

- Close #7254, #7255, #7223, #7224, #7226 — keep the latest one and merge it, or close all five and let the next merge create a fresh one once auto-merge is fixed.
- Audit whether the `Preserve plan details on source PR` comment fired correctly on all five (it should have, but the comment uses `gh pr comment` against `${{ github.event.pull_request.number }}` which only exists in the `pull_request_target` event).

## Acceptance

- The next merge to `master` that includes `PLAN.md` or `HANDOVER.md` produces exactly **one** cleanup PR that auto-merges within the configured CI window.
- The five currently-open cleanup PRs are closed or merged.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/workflows/cleanup-ephemeral-docs.yml and inspect its pull_request_target.closed and push triggers, merge command, and logging. Check the repository's pull-request settings and the open cleanup PRs listed in the issue. Done means the next qualifying merge creates exactly one cleanup PR that auto-merges, and the existing five PRs are closed or merged.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.