Files
kubevirt.core/.github/workflows/docs.yml
T
Felix Matouschek 92d68fdd38 fix(ci): build docs from the checkout instead of a copy
The docs workflow copied the collection to ~/.ansible/collections and ran
the docs action there. actions/checkout v6 stopped writing the token into
.git/config and now keeps it in a separate file referenced by an
includeIf.gitdir entry scoped to the workspace path (PR actions/checkout#2286).
The copy inherits the includeIf entry but not the matching gitdir, so it
had no credentials and the gh-pages push failed.

Put the workspace on the collections path instead. The checkout already
has the ansible_collections/kubevirt/core layout, so the docs build can
run in it directly, which also means checkout's own credentials apply to
the gh-pages push. This removes the manual credential setup added in
38a2548, a13ef97 and 04ae38b.

Verified on a fork: docs build and gh-pages push both succeed.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
2026-08-10 15:08:58 +02:00

63 lines
1.8 KiB
YAML

---
name: Documentation
# yamllint disable-line rule:truthy
on:
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
jobs:
docs:
runs-on: ubuntu-latest
# Do not run in private forks
if: github.repository == 'kubevirt/kubevirt.core'
permissions:
contents: write
env:
collection_dir: ansible_collections/kubevirt/core
# Make the checkout itself resolvable as a collection, so no copy of
# the repository is needed
ANSIBLE_COLLECTIONS_PATH: ${{ github.workspace }}
steps:
- name: Check out code
uses: actions/checkout@v7
with:
path: ${{ env.collection_dir }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
cache: pip
- name: Install doc dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install \
-r ${{ env.collection_dir }}/docs/requirements.txt
pip install \
-r ${{ env.collection_dir }}/requirements.txt
ansible-galaxy collection install \
-r ${{ env.collection_dir }}/requirements.yml \
-p ${{ github.workspace }} --force-with-deps
sudo apt install -y sed hub
- name: Create changelog and documentation
uses: ansible-middleware/collection-docs-action@main
with:
collection_fqcn: kubevirt.core
collection_repo: kubevirt/kubevirt.core
dependencies: false
commit_changelog: false
commit_ghpages: true
changelog_release: false
generate_docs: true
path: ${{ env.collection_dir }}
token: ${{ secrets.GITHUB_TOKEN }}
bot_email: kubevirtbot@redhat.com
bot_account: kubevirt-bot