So, I have a Github Actions file that generates documentation from a private Github repo. I want this to be available inside the repo on dev branch inside docs/ folder. So people could open it and click on index.html. The files are created and uploaded to artifact but unsure how to post that to the Github repository e.g. write the artifact files to the dev branch (or the branch that is making the PR to dev).
name: documentation
# build the documentation whenever there are new commits on main
on:
push:
branches:
- dev
pull_request:
branches:
- "dev"
# Alternative: only build for tags.
# tags:
# - '*'
# security: restrict permissions for CI jobs.
permissions:
contents: write
jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11.4'
# install all dependencies (including pdoc)
- run: pip install -e .
# build your documentation into docs/.
- run: pdoc --html package_name --html-dir docs --force
- uses: actions/upload-artifact@v4
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: docs_data
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: docs/
# The desired behavior if no files are found using the provided path.
# Available Options:
# warn: Output a warning but do not fail the action
# error: Fail the action with an error message
# ignore: Do not output any warnings or errors, the action does not fail
# Optional. Default is 'warn'
if-no-files-found: warn
# If true, an artifact with a matching name will be deleted before a new one is uploaded.
# If false, the action will fail if an artifact for the given name already exists.
# Does not fail if the artifact does not exist.
# Optional. Default is 'false'
overwrite: true