Skip to content

Bump peter-evans/create-or-update-comment (#86) #44

Bump peter-evans/create-or-update-comment (#86)

Bump peter-evans/create-or-update-comment (#86) #44

---
name: Generate Wiki Docs
on:
push:
branches: [main]
paths:
- .github/workflows/_shared*
- .github/workflows/generate-wiki-docs.yml
- .internal/ansible/**
- actions/**/action.yml
env:
# if you want this workflow to run on your fork, you must:
# 1) enable the wiki (and have at minimum a main/default page)
# 2) set the GENERATE_WIKI_PAGES secret in your fork to the value "yes"
SHOULD_RUN: ${{ secrets.GENERATE_WIKI_PAGES == 'yes' || github.repository == 'ansible-community/github-docs-build' }}
jobs:
generate:
env:
WIKI: ${{ github.workspace }}/wiki
ANSIBLE_COLLECTIONS_PATHS: ${{ github.workspace }}/.internal/ansible
runs-on: ubuntu-latest
steps:
- if: fromJSON(env.SHOULD_RUN)
uses: actions/checkout@v3
- name: Checkout wiki
if: fromJSON(env.SHOULD_RUN)
uses: actions/checkout@v3
with:
repository: ${{ github.repository }}.wiki
path: ${{ env.WIKI }}
- uses: actions/setup-python@v5
if: fromJSON(env.SHOULD_RUN)
with:
python-version: '3.11'
- name: Install Ansible
if: fromJSON(env.SHOULD_RUN)
run: pip install 'ansible-core>=2.15,<2.16' --disable-pip-version-check
- name: Generate new docs
if: fromJSON(env.SHOULD_RUN)
run: >-
ansible-playbook
internal.gha_docs.generate_docs
-e "action_output_dir=$WIKI/actions"
-e "workflow_output_dir=$WIKI/workflows"
- name: Publish docs
if: fromJSON(env.SHOULD_RUN)
# @v3 https://github.com/Andrew-Chen-Wang/github-wiki-action/releases/tag/v3
uses: Andrew-Chen-Wang/github-wiki-action@194d37ff03f5220e1baf7eb9d7c7ad7f3e1db30c
env: # this action is written such that the inputs must be specified as env vars
# WIKI_DIR is going to be used with rsync, it MUST end in a forward slash [/]
WIKI_DIR: ${{ env.WIKI }}/
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_MAIL: ${{ github.event.head_commit.author.email }}
# GH_NAME is going to be used raw in a URL in an unquoted commandline, it can't contain spaces
# it's supposed to be a username, not a name, but it doesn't need to be a valid username,
# at least not with GITHUB_TOKEN (for a PAT, may need to match, unsure)
GH_NAME: ${{ github.event.head_commit.author.username || github.repository.owner }}[bot]
WIKI_PUSH_MESSAGE: 'Docs for ${{ github.repository }}/${{ github.event.head_commit.id }} : ${{ github.event.head_commit.message }}'