0

I want my docs on Read the Docs automatically build on every commit I do on a specific branch.

My repo is at Codeberg.org (Gitea). It doesn't use Sphinx but user specific build.command executing pydoctor. This works fine when I click on Build version.

I can confirm that a commit doesn't trigger a build. As you can see in that screenshot the commit on develop didn't trigger a build of the doc. The last doc build was nearly two days before the last commit.

enter image description here

buhtz
  • 10,774
  • 18
  • 76
  • 149
  • 1
    It looks like you figured it out: https://readthedocs.org/projects/buhtzology/builds/19017941/ What was the issue? Did not configure your repo to fire a webhook to RTD for that branch? – Steve Piercy Dec 30 '22 at 02:42

1 Answers1

3

OK, I got it. Now I document the process here. But be aware that I'm new to that topic and maybe there are more elegant ways.

The problem why I asked that question was that I didn't know about the basic concept of the webhook technology.

The goal

Documentation on Read the Docs should be generated ("build") everytime a commit is made to a repository at Codeberg.org which is code hoster running a Gitea instance.

Concept

That Gitea instance need to be configured that way that it will send an event/trigger somewhere else. In this case to Read the Docs. On the other side Read the Docs need to be configured to receive that event and react on it with starting the build process.

The webhook on Codeberg.org is the finger and the integration/incoming webhook on Read the Docs is the button. You first have to configure Read the Docs (the button) and Codeberg (with it's finger) after it.

Configure Read the Docs

This how to assume that the project is configured in Read the Docs and it building the documentation can be triggered manually without errors.

  • Login into your Read the Docs account and select the project (1).
  • Click on the button Admin (2).
  • Click on Integrations in the left side menu (3).
  • Click on the button Add Integration (4).
  • Select GitHub incoming webhook without wondering about that GitHub is not Gitea.

enter image description here

  • A page comes up with the configured webhook offering an URL like readthedocs.org/api/v2/webhook/buhtzology/222213/.

Configure Codeberg.org

  • Go to the Settings of your repository. (1)
  • Select Webhooks (2).
  • Select Add Webhook (3).
  • Select Gitea (4).

enter image description here

A form comes up with several fields

  • Target URL: Paste in the URL you have from the Read the Docs webhook in the previous section. But don't forget to add https:// in front of it.
  • HTTP Method: Should be "POST" by default.
  • POST Content Type: "application/json" (also "application/x-www-form-urlencoded" works)
  • Secret: Leave it empty.

Also choose a Trigger of your choice and make sure that the Activate checkbox at the end of the form is selected.

Click the button Add Webook.

Select the webhook again from the Webhooks list and find the button Test Delivery at the end. Click on it!

Check Read the Docs

When everything is fine this activaty indicator should come up on the previously configured webhook at Read the Docs.

enter image description here

buhtz
  • 10,774
  • 18
  • 76
  • 149