Skip to content

Adding include_prereleases flag and ignoring draft releases - #14

Open
djpugh wants to merge 1 commit into
mainfrom
fix/draft-releases-#13
Open

Adding include_prereleases flag and ignoring draft releases#14
djpugh wants to merge 1 commit into
mainfrom
fix/draft-releases-#13

Conversation

@djpugh

@djpugh djpugh commented Jan 8, 2025

Copy link
Copy Markdown
Owner

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Have you updated the appropriate files

Please check that you have (if appropriate):

  • Updated the documentation
  • Updated README.md
  • Executed pre-commit run --all-files with no errors
  • The change is fully covered by automated unit tests

What is the current behavior?

Issue: #13

What is the new behavior?

  • Adds flag to include prereleases (and sets as false as default)
  • Skips draft releases

Other information

@github-actions github-actions Bot added the fix label Jan 8, 2025
@sonarqubecloud

Copy link
Copy Markdown

djpugh added a commit that referenced this pull request Aug 5, 2026
* fix: support ghapi 2.x and skip draft releases

Two independent faults, both of which fail the whole docs build.

ghapi 2.0 made operation calls asynchronous by default, so `paged(...)` yields
an async generator and iterating it raises "'async_generator' object is not
iterable". The same release added a `sync` flag selecting a synchronous
transport; `_make_api` sets it when the installed signature declares it, so
ghapi 1.x is unaffected.

Draft releases were not filtered. A draft is unpublished, so GitHub returns no
`published_at` -- ghapi surfaces that as an empty AttrDict, which reached
`datetime.fromisoformat` and raised "argument must be str". Drafts also have an
empty name, so they could only ever render as a broken, dateless entry. They are
now skipped, and a published release somehow lacking a timestamp is warned about
and skipped rather than failing the build.

The date coercion now branches on the value's type rather than the Python
version. The version check remains only for choosing how to parse a string,
since fromisoformat cannot handle a trailing Z before 3.11.

Verified end to end: nskit's docs build previously failed on both faults and now
completes, rendering four releases with dates and excluding the draft.

* feat: add include_prereleases option (supersedes #14)

Folds in #14's prerelease flag, with three corrections.

The filter reads `release.prerelease`. #14 spelt it `prelease`, and since a
missing key on ghapi's AttrDict is falsy, the flag would have silently never
filtered anything while appearing to work.

The option is wired through. #14 added it to PluginConfig and to
get_releases_as_markdown, but extension.py plucks each option individually and
was not updated, so the config never reached the call.

Naming is consistent: `include_prereleases` everywhere, rather than a plural
config key against a singular function parameter.

Drafts remain excluded regardless of the flag, since they are unpublished and
carry no timestamp.

The shared test fixtures now set `prerelease` explicitly, for the same reason
the existing comment gives for `draft`: a bare MagicMock returns a truthy mock
for any unset attribute, so an unset flag silently empties the result. One test
drives the filter through an AttrDict so a misspelt attribute raises instead of
quietly passing -- which is what let #14's typo through.

* fix: use sync_paged on ghapi 2.x

paged() is an async generator on 2.x even with sync=True, so iterating it
raised "async_generator object is not iterable".

* test: match mkdocs fail-fast config validation

Config._validate breaks on the first error, so only one is ever reported;
each option is now checked individually instead.

* ci: audit with pip-audit instead of pipenv check

pipenv check delegates to safety, which prompts to install itself and
needs an API key, so it fails with EOFError on CI. Also add lxml, which
mypy needs for its cobertura report.

* test: set draft/prerelease on functional release mocks

An unset MagicMock attribute is truthy, so every mocked release looked
like a draft prerelease and was filtered out of the built changelog.

* test: drop webbrowser.open from functional tests

Launching a browser held the temp file open, so cleanup failed on Windows
with WinError 32.

* ci: unbreak 3.8/3.9 test jobs and the licence scan

argcomplete 3.7.1 does not import on 3.8/3.9, so nox never started. pip
26.2 dropped an internal pip-tools relies on, so use uv to compile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant