ansible-community / github-docs-build

GitHub actions and workflows for building Ansible collection documentation.
GNU General Public License v3.0
10 stars 6 forks source link

Add option publish-gh-pages-branch #93

Closed felixfontein closed 2 months ago

felixfontein commented 2 months ago

I've tried integrating updating GH Pages into the shared workflow (_shared-docs-build-publish-gh-pages.yml), and after some tries it seems to work. This PR adds a new option, publish-gh-pages-branch, which needs to be explicitly enabled like this: https://github.com/ansible-collections/community.hrobot/commit/933f952c14072f635fb43c35f94dfe9459007fc5 (obviously without pointing to the workflow in my branch once this is merged ;) )

Successful run: https://github.com/ansible-collections/community.hrobot/actions/runs/9702624870. That run made https://ansible-collections.github.io/community.hrobot/pr/114/firewall_module.html#synopsis show Test! as the last paragraph of the Description (before it was test).

I'm not sure whether this is the best solution, and I'm also a bit surprised that not having environment: github-pages there works. (I had it in the shared workflow first, that made it fail.)

felixfontein commented 2 months ago

The main reason for the default false is that additional permissions are needed. If these aren't present, then the workflow will start failing (which among others mean: CI is always failing in PRs). If this isn't merged, then the workflow will effectively stop working since the gh-pages branch is no longer taken as the source for GH Pages, but the workflow won't fail.

Also: it could (theoretically) be that some user of this workflow already implemented the gh-pages branch to GH Pages update in another way - for them this would be a breaking change.

felixfontein commented 2 months ago

Thanks for reviewing this!

felixfontein commented 2 months ago

Hmm, maybe that argument wasn't right, since without adjustment the docs workflows now also fail: https://github.com/ansible-collections/community.sops/actions/runs/9725081312

The workflow is not valid. .github/workflows/docs-pr.yml (Line: 36, Col: 3): Error calling workflow 'ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main'. The nested job 'publish-gh-pages' is requesting 'pages: write, id-token: write', but is only allowed 'pages: none, id-token: none'.

gardar commented 2 months ago

Hmm, maybe that argument wasn't right, since without adjustment the docs workflows now also fail: https://github.com/ansible-collections/community.sops/actions/runs/9725081312

The workflow is not valid. .github/workflows/docs-pr.yml (Line: 36, Col: 3): Error calling workflow 'ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main'. The nested job 'publish-gh-pages' is requesting 'pages: write, id-token: write', but is only allowed 'pages: none, id-token: none'.

Yep, also noticed this happening here: https://github.com/prometheus-community/ansible/actions/runs/9740090100 So this is actually a breaking change.