| 1 |
name: Collection Docs |
| 2 |
concurrency: |
| 3 |
group: docs-pr-${{ github.event.pull_request.number || github.ref }} |
| 4 |
cancel-in-progress: true |
| 5 |
on: |
| 6 |
pull_request_target: # zizmor: ignore[dangerous-triggers] -- pull_request_target is required to have permissions to comment on PRs from forks |
| 7 |
types: [opened, synchronize, reopened, closed] |
| 8 |
|
| 9 |
env: |
| 10 |
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
|
| 15 |
jobs: |
| 16 |
validate-docs: |
| 17 |
permissions: |
| 18 |
contents: read |
| 19 |
name: Validate Ansible Docs |
| 20 |
if: github.event.action != 'closed' |
| 21 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@50bb8f670ad5ff11443bd94e51369debb8d34775 # main |
| 22 |
with: |
| 23 |
artifact-upload: false |
| 24 |
init-lenient: false |
| 25 |
init-fail-on-error: true |
| 26 |
build-ref: refs/pull/${{ github.event.number }}/merge |
| 27 |
|
| 28 |
build-docs: |
| 29 |
permissions: |
| 30 |
contents: read # Required for reading collection content |
| 31 |
pages: write # Required for publishing docs to GitHub Pages |
| 32 |
id-token: write # Required for OIDC authentication |
| 33 |
name: Build Ansible Docs |
| 34 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-pr.yml@50bb8f670ad5ff11443bd94e51369debb8d34775 # main |
| 35 |
with: |
| 36 |
init-lenient: true |
| 37 |
init-fail-on-error: false |
| 38 |
render-file-line: '> * `$<status>` [$<path_tail>](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$<path_tail>)' |
| 39 |
|
| 40 |
publish-docs-gh-pages: |
| 41 |
# for now we won't run this on forks |
| 42 |
if: github.repository == 'lowlydba/lowlydba.sqlserver' |
| 43 |
permissions: |
| 44 |
contents: write # Required for writing release/tag artifacts |
| 45 |
pages: write # Required for publishing docs to GitHub Pages |
| 46 |
id-token: write # Required for OIDC authentication |
| 47 |
needs: [build-docs] |
| 48 |
name: Publish Ansible Docs |
| 49 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@50bb8f670ad5ff11443bd94e51369debb8d34775 # main |
| 50 |
with: |
| 51 |
artifact-name: ${{ needs.build-docs.outputs.artifact-name }} |
| 52 |
action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }} |
| 53 |
secrets: |
| 54 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 |
|
| 56 |
comment: |
| 57 |
permissions: |
| 58 |
pull-requests: write # Required for commenting on PRs |
| 59 |
runs-on: ubuntu-slim |
| 60 |
needs: [publish-docs-gh-pages, build-docs] |
| 61 |
name: PR comments |
| 62 |
steps: |
| 63 |
- name: PR comment |
| 64 |
uses: ansible-community/github-docs-build/actions/ansible-docs-build-comment@50bb8f670ad5ff11443bd94e51369debb8d34775 # zizmor: ignore[stale-action-refs] -- Using main branch SHA of ansible-community maintained action; branch is stable |
| 65 |
with: |
| 66 |
body-includes: '## Docs Build' |
| 67 |
reactions: heart |
| 68 |
action: ${{ needs.build-docs.outputs.changed != 'true' && 'remove' || '' }} |
| 69 |
on-closed-action: remove |
| 70 |
on-merged-body: | |
| 71 |
## Docs Build 📝 |
| 72 |
|
| 73 |
Thank you for contribution!✨ |
| 74 |
|
| 75 |
This PR has been merged and the docs are now incorporated into `main`: |
| 76 |
${{ env.GHP_BASE_URL }}/branch/main |
| 77 |
body: | |
| 78 |
## Docs Build 📝 |
| 79 |
|
| 80 |
Thank you for contribution!✨ |
| 81 |
|
| 82 |
The docs for **this PR** have been published here: |
| 83 |
${{ env.GHP_BASE_URL }}/pr/${{ github.event.number }} |
| 84 |
|
| 85 |
You can compare to the docs for the `main` branch here: |
| 86 |
${{ env.GHP_BASE_URL }}/branch/main |
| 87 |
|
| 88 |
The docsite for **this PR** is also available for download as an artifact from this run: |
| 89 |
${{ needs.build-docs.outputs.artifact-url }} |
| 90 |
|
| 91 |
File changes: |
| 92 |
|
| 93 |
${{ needs.build-docs.outputs.diff-files-rendered }} |
| 94 |
|
| 95 |
${{ needs.build-docs.outputs.diff-rendered }} |