|
6 | 6 | paths: |
7 | 7 | - .github/workflows/_shared* |
8 | 8 | - .github/workflows/generate-wiki-docs.yml |
| 9 | + - .internal/ansible/** |
9 | 10 | - actions/**/action.yml |
10 | 11 |
|
| 12 | +env: |
| 13 | + # if you want this workflow to run on your fork, you must: |
| 14 | + # 1) enable the wiki (and have at minimum a main/default page) |
| 15 | + # 2) set the GENERATE_WIKI_PAGES secret in your fork to the value "yes" |
| 16 | + SHOULD_RUN: ${{ secrets.GENERATE_WIKI_PAGES == 'yes' || github.repository == 'ansible-community/github-docs-build' }} |
| 17 | + |
11 | 18 | jobs: |
12 | 19 | generate: |
13 | 20 | env: |
14 | | - # this path is going to be used with rsync, it MUST end in a forward slash [/] |
15 | | - WIKI: ${{ github.workspace }}/wiki/ |
| 21 | + WIKI: ${{ github.workspace }}/wiki |
16 | 22 | ANSIBLE_COLLECTIONS_PATHS: ${{ github.workspace }}/.internal/ansible |
17 | 23 | runs-on: ubuntu-latest |
18 | 24 | steps: |
19 | | - - uses: actions/checkout@v2 |
| 25 | + - if: fromJSON(env.SHOULD_RUN) |
| 26 | + uses: actions/checkout@v2 |
20 | 27 |
|
21 | 28 | - name: Checkout wiki |
| 29 | + if: fromJSON(env.SHOULD_RUN) |
22 | 30 | uses: actions/checkout@v2 |
23 | 31 | with: |
24 | 32 | repository: ${{ github.repository }}.wiki |
25 | 33 | path: ${{ env.WIKI }} |
26 | 34 |
|
27 | 35 | - uses: actions/setup-python@v2 |
| 36 | + if: fromJSON(env.SHOULD_RUN) |
28 | 37 | with: |
29 | 38 | python-version: '3.9' |
30 | 39 |
|
31 | 40 | - name: Install Ansible |
| 41 | + if: fromJSON(env.SHOULD_RUN) |
32 | 42 | run: pip install 'ansible-core>=2.12,<2.13' --disable-pip-version-check |
33 | 43 |
|
34 | 44 | - name: Generate new docs |
| 45 | + if: fromJSON(env.SHOULD_RUN) |
35 | 46 | run: >- |
36 | 47 | ansible-playbook |
37 | 48 | internal.gha_docs.generate_docs |
38 | 49 | -e "action_output_dir=$WIKI/actions" |
39 | 50 | -e "workflow_output_dir=$WIKI/workflows" |
40 | 51 |
|
41 | 52 | - name: Publish docs |
| 53 | + if: fromJSON(env.SHOULD_RUN) |
42 | 54 | # @v2 https://github.com/Andrew-Chen-Wang/github-wiki-action/releases/tag/v2 |
43 | 55 | uses: Andrew-Chen-Wang/github-wiki-action@b386aca0ddc5ec22b6003ba4cb50fa0b17243f6c |
44 | 56 | env: # this action is written such that the inputs must be specified as env vars |
45 | | - WIKI_DIR: ${{ env.WIKI }} |
| 57 | + # WIKI_DIR is going to be used with rsync, it MUST end in a forward slash [/] |
| 58 | + WIKI_DIR: ${{ env.WIKI }}/ |
46 | 59 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 | 60 | GH_MAIL: ${{ github.event.head_commit.author.email }} |
48 | | - GH_NAME: ${{ github.event.head_commit.author.name }}[bot] |
| 61 | + # GH_NAME is going to be used raw in a URL in an unquoted commandline, it can't contain spaces |
| 62 | + # it's supposed to be a username, not a name, but it doesn't need to be a valid username, |
| 63 | + # at least not with GITHUB_TOKEN (for a PAT, may need to match, unsure) |
| 64 | + GH_NAME: ${{ github.event.head_commit.author.username || github.repository.owner }}[bot] |
49 | 65 | WIKI_PUSH_MESSAGE: 'Docs for ${{ github.repository }}/${{ github.event.head_commit.id }} : ${{ github.event.head_commit.message }}' |
0 commit comments