Skip to content

Add GitHub workflow timeout pre-commit hook - #695

Merged
sirosen merged 1 commit into
python-jsonschema:mainfrom
w3lld1:feat/github-workflow-timeout-hook
Jul 13, 2026
Merged

sirosen merged 1 commit into
python-jsonschema:mainfrom
w3lld1:feat/github-workflow-timeout-hook

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a dedicated check-github-workflows-require-timeout pre-commit hook backed by the existing custom timeout schema
  • teach hook generation to emit both vendored and custom-schema hooks with the correct builtin namespace
  • generate the hook documentation and add an unreleased changelog entry
  • cover the generated hook ID, custom-schema entry, file pattern, and YAML type

Fixes #639

Validation

  • uvx pre-commit run --all-files
  • tox run -e generate-hooks-config
  • tox run -e mypy
  • tox run -e docs
  • tox run -e py311 -- -k 'not memfd' -q — 609 passed, 13 skipped, 3 deselected
  • direct positive/negative fixture checks with --builtin-schema custom.github-workflows-require-timeout
  • git diff --check

I also ran the complete Python 3.11 suite. It reached 609 passed and 13 skipped, but this sandbox's Python build does not expose os.memfd_create, so the three existing memfd-specific tests failed with AttributeError. Those tests are unrelated to this hook change and are included in the upstream CI matrix on standard GitHub runners.

@sirosen

sirosen commented Jul 13, 2026

Copy link
Copy Markdown
Member

Thanks for sending this, it looks good to go!

@sirosen
sirosen merged commit de21be9 into python-jsonschema:main Jul 13, 2026
25 checks passed
Comment thread docs/precommit_usage.rst
Comment on lines +419 to +421
rev: 0.37.4
hooks:
- id: check-github-workflows-require-timeout

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This hook is not included in 0.37.4 and trying to use as instructed here fails with

  caused by: Hook `check-github-workflows-require-timeout` was not found in repository `https://github.com/python-jsonschema/check-jsonschema@0.37.4`. Check the hook ID or choose a `rev` that includes it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use as instructed

Are you looking at https://check-jsonschema.readthedocs.io/en/latest/? The docs corresponding to 0.37.4 are actually https://check-jsonschema.readthedocs.io/en/stable.

So Stephen might want to update the default version on ReadTheDocs to be stable to avoid misguiding users that land on the default version page.

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.

First off:

  1. Good call, I should change the RTD config to make stable the default!
  2. I'll do a release today. Usually I do one right away when a new hook gets added, but I clearly didn't this time.

A new hook probably shouldn't be added with the previous release number, but the doc generator doesn't have a good workaround for this. It's interesting to think about how to make this better. I'm a big fan of the version being static data in pyproject.toml, but maybe latest doc builds could "smudge" the version somehow... 🤔

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github-workflows-require-timeout git hook

4 participants