From 92d68fdd387c62519e148c135bbb8d8e4a211955 Mon Sep 17 00:00:00 2001 From: Felix Matouschek Date: Mon, 10 Aug 2026 15:08:58 +0200 Subject: [PATCH] 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 --- .github/workflows/docs.yml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4fce783..8488a4a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,9 @@ jobs: contents: write env: collection_dir: ansible_collections/kubevirt/core - work_dir: /home/runner/.ansible/collections + # 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 @@ -39,25 +41,11 @@ jobs: -r ${{ env.collection_dir }}/docs/requirements.txt pip install \ -r ${{ env.collection_dir }}/requirements.txt - mkdir -p ${{ env.work_dir }} ansible-galaxy collection install \ -r ${{ env.collection_dir }}/requirements.yml \ - -p ${{ env.work_dir }} --force-with-deps + -p ${{ github.workspace }} --force-with-deps sudo apt install -y sed hub - - name: Move collection to work dir - run: | - cp -rp ansible_collections \ - ${{ env.work_dir }} - - - name: Set up git credentials for gh-pages push - run: | - BASIC_AUTH=$(echo -n "x-access-token:${GITHUB_TOKEN}" | base64) - git config --global http.https://github.com/.extraheader \ - "AUTHORIZATION: basic ${BASIC_AUTH}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create changelog and documentation uses: ansible-middleware/collection-docs-action@main with: @@ -68,7 +56,7 @@ jobs: commit_ghpages: true changelog_release: false generate_docs: true - path: ${{ env.work_dir }}/${{ env.collection_dir }} + path: ${{ env.collection_dir }} token: ${{ secrets.GITHUB_TOKEN }} bot_email: kubevirtbot@redhat.com bot_account: kubevirt-bot