Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build Docs
on:
workflow_dispatch:
pull_request:
paths:
- "docs/**"
push:
branches:
- main
paths:
- "docs/**"

jobs:
build:
uses: reqstool/.github/.github/workflows/build-docs.yml@main

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 6 days ago

In general, the problem is fixed by explicitly declaring a permissions block that restricts the GITHUB_TOKEN to the least privileges needed. Since this workflow only triggers a reusable workflow and there is no indication it needs write access, a safe minimal default is contents: read at the workflow root. Root‑level permissions apply to all jobs that do not override them, including the build job here.

The single best way to fix this without changing existing functionality is to add a root‑level permissions section immediately after the name: line (line 1). For example:

name: Build Docs
permissions:
  contents: read

This keeps the existing triggers and the build job unchanged and only narrows the default GITHUB_TOKEN privileges for this workflow. No additional imports or methods are needed, since this is a GitHub Actions YAML configuration change only.

Concretely:

  • Edit .github/workflows/build-docs.yml.
  • Insert a permissions block after line 1 (name: Build Docs), before the on: section.
  • Set contents: read as a minimal, least‑privilege default suitable for a documentation build workflow that should not need to push changes or modify repo state.
Suggested changeset 1
.github/workflows/build-docs.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml
--- a/.github/workflows/build-docs.yml
+++ b/.github/workflows/build-docs.yml
@@ -1,4 +1,6 @@
 name: Build Docs
+permissions:
+  contents: read
 on:
   workflow_dispatch:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: Build Docs
permissions:
contents: read
on:
workflow_dispatch:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading