Conversation
Call the centralized reusable workflow from reqstool/.github to validate Antora docs build cleanly on PRs and pushes to main. Signed-off-by: jimisola <jimisola@jimisola.com>
|
|
||
| jobs: | ||
| build: | ||
| uses: reqstool/.github/.github/workflows/build-docs.yml@main |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
In general, the problem is fixed by adding an explicit permissions block either at the root of the workflow (applies to all jobs) or under the specific job. Since this workflow only delegates to a reusable workflow, the top-level workflow itself typically only needs read access to repository contents (for checkout or for the reusable workflow to read docs). A minimal and safe configuration is permissions: contents: read at the workflow level.
The best way to fix this specific file without changing existing functionality is to add a root-level permissions section beneath the name (or at the same top level as on and jobs). This will apply to all jobs, including build, unless that job or the called reusable workflow overrides permissions. Given the information available, we should choose a least-privilege default: contents: read. If the reusable workflow requires more (e.g., to publish pages or comment on PRs), it can still request elevated permissions in its own file; our addition here will not break that, since job-level permissions in the reusable workflow can be more specific. Concretely, in .github/workflows/build-docs.yml, insert:
permissions:
contents: readat the top level between name: Build Docs and on: (or immediately before jobs:; both are valid). No imports or external methods are needed.
| @@ -1,4 +1,6 @@ | ||
| name: Build Docs | ||
| permissions: | ||
| contents: read | ||
| on: | ||
| workflow_dispatch: | ||
| pull_request: |
Summary
docs/**files changereqstool/.githubTest plan