Skip to content

fix: Add write permissions to GITHUB_TOKEN in workflow docs-publish.y… #741

fix: Add write permissions to GITHUB_TOKEN in workflow docs-publish.y…

fix: Add write permissions to GITHUB_TOKEN in workflow docs-publish.y… #741

Workflow file for this run

# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <korte.termijn.prognoses@alliander.com> # noqa E501
#
# SPDX-License-Identifier: MPL-2.0
name: Deploy Sphinx documentation to Pages
# Runs on pushes targeting the default branch
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- uses: actions/setup-python@v2
- uses: actions/checkout@master
with:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
# Setup python version
- uses: actions/setup-python@v4
with:
python-version: '3.11'
# Run pre-build command
- run: |
cp requirements.txt docs/requirements.txt &&\
printf "\npydata-sphinx-theme==0.12.0\n" >> docs/requirements.txt &&\
printf "\njinja2==3.0.0\n" >> docs/requirements.txt &&\
printf "\nsphinx_autodoc_typehints==1.19.4\n" >> docs/requirements.txt &&\
printf "\nmkdocs==1.2.3\n" >> docs/requirements.txt &&\
pip install -r docs/requirements.txt &&\
sphinx-apidoc -o docs openstef
- name: Build and commit
uses: sphinx-notes/pages@v2
with:
requirements_path: ./docs/requirements.txt
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages