buildthedocs / btd

A multi-version Sphinx building tool based on containers
https://buildthedocs.github.io/btd/
Apache License 2.0
12 stars 2 forks source link

Doc being published despite token non being set in .btd.yml file #7

Closed akire0ne closed 3 years ago

akire0ne commented 3 years ago

Hi !

In your documentation, you state the following:

If parameter token is provided, the Action will upload the results (typically to branch gh-pages). Users can prevent results being uploaded by not providing the token. Then, docs will be only built.

Source: https://buildthedocs.github.io/btd/gha/action.html

I have a GitHub action set to build the docs on a staging branch but I do not want to publish it.

the .btd-upstream.yml file looks like this :

# Path to input sources
# Absolute or relative to the location of this configuration file
input: docs

# Path to save intermediate artifacts and products
# Absolute or relative to 'input'
output: _build

# Path to an optional requirements file
# Absolute or relative to 'input'
requirements: requirements.txt

# Domain/repo/branch|tag where sources are located:
source: upstream

# Domain/repo/branch and path where products are to be deployed:
target: gh-pages-upstream

# List of output formats
formats: [ html ]

# List of versions
#versions:
#  - id: master
#    title: ""
#    description: ""
#    warning: ""
#  - id: v0.0.0

# Images to run commands in
images:
  latex: btdi/latex

# Install theme from a repo or a tarball
theme: https://codeload.github.com/buildthedocs/sphinx.theme/tar.gz/v0`

My GitHub action looks like this:

---
name: build_the_docs_upstream

on:
  push:
    branches:
      - upstream

jobs:

  publish_docs:
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v2

      - uses: buildthedocs/btd@v0
        with:
          config: '.btd-upstream.yml'

      - uses: actions/upload-artifact@v2
        with:
          name: docs_upstream
          path: docs/_build/html

Note i am not setting any token here. My docs is well built (Build html... is successfull) however the github action insists on publishing it (Publish...) The error message is something to with authentication

[...]
 create mode 100644 software/python.html
  create mode 100644 software/tools.html
remote: Invalid username or password.
  fatal: Authentication failed for 'https://github.com/mila-iqia/mila-docs/'
  Traceback (most recent call last):
    File "/btd/cli.py", line 89, in <module>
      CLI().Run()
    File "/btd/cli.py", line 61, in Run
      ArgParseMixin.Run(self)
    File "/usr/local/lib/python3.9/site-packages/pyAttributes/ArgParseAttributes.py", line 304, in Run
      self._ParseArguments()
    File "/usr/local/lib/python3.9/site-packages/pyAttributes/ArgParseAttributes.py", line 316, in _ParseArguments
      self._RouteToHandler(args)
    File "/usr/local/lib/python3.9/site-packages/pyAttributes/ArgParseAttributes.py", line 320, in _RouteToHandler
      args.func(self, args)
    File "/btd/cli.py", line 86, in HandleRun
      self.run()
    File "/btd/cli.py", line 32, in run
      BTDRun()
    File "/btd/__init__.py", line 207, in BTDRun
      publish(
    File "/btd/__init__.py", line 96, in publish
      check_call(cmd, cwd=str(bdir))
    File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['git', 'push', '-u', 'origin', '+HEAD:gh-pages']' returned non-zero exit status 128.

We can see in the list line that he tries to push to gh-pages , but here i choosed gh-pages-upstream as a target in .btd-upstream.yml So I am either doing it wrong, or the statement on the doc is not true. I do not want to publish this doc, I just want to build it then save it to artifacts for external processing. Thanks for the help

eine commented 3 years ago

Hi @achillemyette1! Sorry about the delay in coming back. This is mainly a dependency of some other projects I co-maintain, so it's not intensively developed itself.

I added an explicit option for skipping publishing. Now you can set skip-deploy: true in the GitHub Actions step.

Pushing to a branch other than gh-pages is not properly handled yet. See #8.