Skip to content

MNT: Skip ReadTheDocs build on skip-ci commits#8636

Open
karlhillx wants to merge 3 commits into
sunpy:mainfrom
karlhillx:rtd-skip-ci
Open

MNT: Skip ReadTheDocs build on skip-ci commits#8636
karlhillx wants to merge 3 commits into
sunpy:mainfrom
karlhillx:rtd-skip-ci

Conversation

@karlhillx
Copy link
Copy Markdown

Description

When a commit is pushed with [skip ci] or [ci skip], GitHub Actions respects the marker and skips the relevant workflow runs, but Read the Docs currently ignores it and triggers a full documentation build anyway.

This PR adds a post_checkout hook to .readthedocs.yaml that checks the latest commit message for those skip markers. If one is found, the hook exits with code 183, which Read the Docs officially uses to cancel the build cleanly. (We bypass the RTD YAML quote-stripping bug by executing it via a base64 string).

This brings RTD's behavior in line with GHA, avoiding unnecessary build minutes for commits that intentionally skip CI while keeping normal documentation builds completely unchanged. (This matches the infrastructure update recently requested by the Astropy team).

Copy link
Copy Markdown
Member

@Cadair Cadair left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, this is a neat solution.

Comment thread .readthedocs.yaml Outdated
jobs:
post_checkout:
- git fetch --unshallow || true
- echo aWYgZ2l0IGxvZyAtMSAtLWZvcm1hdD0lQiB8IGdyZXAgLWlxRSAnXFsoY2kgc2tpcHxza2lwIGNpKVxdJzsgdGhlbiBleGl0IDE4MzsgZmkK | base64 -d > skip.sh
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.

I'm not a fan on having this base64 encoded. I'd much rather have the script inside the tools/ directory if it's not possible to have it inline.

Can you link the RTD bug?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed — script is now at tools/skip-rtd.sh and referenced directly from .readthedocs.yaml. No more base64.

The encoding was a workaround for RTD's YAML processing edge cases; keeping the script in tools/ sidesteps that cleanly.

RTD issue tracking the broader [skip ci] commit support gap: readthedocs/readthedocs.org#871

Address review feedback: move the base64-encoded bash logic out of the
RTD config and into tools/skip-rtd.sh. The script is now readable and
maintainable, and referenced directly from .readthedocs.yaml.

RTD handles exit 183 as a build-cancellation signal, but inline shell
in YAML jobs can trigger RTD's YAML processing edge cases with certain
characters; a separate script file avoids this.
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.

2 participants