Skip to content

Update plugin list on maintenance branch to keep stable docs current#14538

Merged
nicoddemus merged 5 commits into
pytest-dev:mainfrom
dyollb:fix-plugin-list-stable-docs
Jun 17, 2026
Merged

Update plugin list on maintenance branch to keep stable docs current#14538
nicoddemus merged 5 commits into
pytest-dev:mainfrom
dyollb:fix-plugin-list-stable-docs

Conversation

@dyollb

@dyollb dyollb commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

docs.pytest.org/en/stable is built from the maintenance branch (e.g. 9.0.x), not main. The weekly plugin list update only targets main, so stable docs show a frozen plugin list from the release cut.

Fix

Update the workflow to:

  1. Find the current maintenance branch dynamically (highest N.N.x)
  2. Run the same plugin list update
  3. Create a PR to main and apply backport <branch> label
  4. Patchback automatically cherry-picks the PR to the maintenance branch once merged

This uses pytest's existing backport automation, avoiding merge conflicts and duplicate logic.

Also adds missing if guard to the "Instruct maintainers" step to prevent failures when there are no plugin list changes.

The weekly plugin list update only targets `main`, which means
docs.pytest.org/en/stable (built from the maintenance branch, e.g.
9.0.x) always shows a stale plugin list frozen at the time of release.

Add a second job that dynamically finds the latest maintenance branch
and creates a PR to update plugin_list.rst there too.
@dyollb dyollb marked this pull request as ready for review May 31, 2026 12:54
@nicoddemus

Copy link
Copy Markdown
Member

Thanks @dyollb!

However I fear this might create merge conflicts when we need to merge the maintenance branch back into main after a release.

What if we just apply the appropriate "backport" label to the PR that is created to main? I this would remove the chance of conflicts, as backports are cherry-picked.

@bluetech

Copy link
Copy Markdown
Member

Alternatively, add a note at the top saying to look at /latest

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

a workflow that auto sync it may be more fitting - we dont need to backport like a patch - we can jsut take the verbatim content and update the blob

@nicoddemus

Copy link
Copy Markdown
Member

we dont need to backport like a patch

We "don't", but might be the simplest solution.

@dyollb

dyollb commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @dyollb!

However I fear this might create merge conflicts when we need to merge the maintenance branch back into main after a release.

What if we just apply the appropriate "backport" label to the PR that is created to main? I this would remove the chance of conflicts, as backports are cherry-picked.

I tried to change the PR to use your label approach. Is this what you meant? Thanks

@nicoddemus

Copy link
Copy Markdown
Member

Yes it is, thanks!

Could you take a look at the linting failures please? It suggests it can auto-fix the issues if ran locally.

@nicoddemus nicoddemus added the skip news used on prs to opt out of the changelog requirement label Jun 16, 2026
@nicoddemus

Copy link
Copy Markdown
Member

Thanks!

I will merge this tomorrow to give time for others to speak up in case they have concerns with this approach. 👍

@The-Compiler The-Compiler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach seems fine to me, iff it actually works (there are some limitations regarding labels added automatically then triggering automated workflows again, afaik). @webknjaz any thoughts?

I have one suggestion regarding tooling, but no hard feelings either way.

Comment on lines +25 to +29
branch=$(git ls-remote --heads https://github.com/pytest-dev/pytest.git \
| grep -oE 'refs/heads/[0-9]+\.[0-9]+\.x' \
| sed 's|refs/heads/||' \
| sort -t. -k1,1n -k2,2n \
| tail -1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branch=$(git ls-remote --heads https://github.com/pytest-dev/pytest.git \
| grep -oE 'refs/heads/[0-9]+\.[0-9]+\.x' \
| sed 's|refs/heads/||' \
| sort -t. -k1,1n -k2,2n \
| tail -1)
branch=$(git ls-remote --heads --sort=v:refname https://github.com/pytest-dev/pytest.git 'refs/heads/*.x' \
| sed '$!d;s|.*\trefs/heads/||')

to use the existing capabilities of git ls-remote and sed (sed one-liners is great for this).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Switched branch discovery to the reviewer’s version-sorted command
  2. Added fail-fast validation so the job exits clearly if no *.x branch is found
  3. I also tightened the label step guard so it only runs when both PR number and branch are present

@dyollb

dyollb commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

The approach seems fine to me, iff it actually works (there are some limitations regarding labels added automatically then triggering automated workflows again, afaik). @webknjaz any thoughts?

I have one suggestion regarding tooling, but no hard feelings either way.

As far as I understand:

  • If automation depends on another GitHub Actions workflow triggered by label events, labels added by a workflow token can be skipped due to recursion protections.
  • In this repo, backporting is handled by Patchback config in patchback.yml, which indicates an app-style backport flow, not a local Actions workflow. That usually avoids the specific recursion limitation.

@nicoddemus nicoddemus merged commit 9fa5673 into pytest-dev:main Jun 17, 2026
36 checks passed
@nicoddemus

Copy link
Copy Markdown
Member

@nicoddemus

Copy link
Copy Markdown
Member

Hmmm:

Run gh pr label add "$PULL_REQUEST_NUMBER" --repo 'pytest-dev/pytest' --labels "backport $BRANCH_NAME"
  
unknown flag: --labels

Actually there is no gh pr label command, we probably need gh pr edit --add-label.

My bad, I assumed the command was verified before the PR was submitted, but I should have verified this myself.

@nicoddemus

nicoddemus commented Jun 17, 2026

Copy link
Copy Markdown
Member

Follow up: #14616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news used on prs to opt out of the changelog requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants