Skip to content

Commit 2dcf904

Browse files
committed
Keep documentation builds read-only before deployment
Signed-off-by: Ralf W. Grosse-Kunstleve <[email protected]>
1 parent 0934b39 commit 2dcf904

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎.github/workflows/build-docs.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ on:
5252
jobs:
5353
build:
5454
name: Build docs
55+
permissions:
56+
contents: read
57+
pull-requests: read
5558
# The build stage could fail but we want the CI to keep moving.
5659
if: ${{ github.repository_owner == 'nvidia' && !cancelled() }}
5760
runs-on: ubuntu-latest

‎ci/tools/tests/test_release_publish_security.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
def test_release_publishers_do_not_execute_repository_or_dependency_code():
1212
workflow = Path(__file__).resolve().parents[3] / ".github/workflows/release.yml"
1313
jobs = yaml.safe_load(workflow.read_text(encoding="utf-8"))["jobs"]
14-
preparation = jobs["prepare-artifacts"]
15-
assert set(preparation["permissions"].values()) == {"read"}
16-
assert "environment" not in preparation
14+
docs = yaml.safe_load(workflow.with_name("build-docs.yml").read_text(encoding="utf-8"))["jobs"]["build"]
15+
for builder in (jobs["prepare-artifacts"], docs):
16+
assert "write" not in builder["permissions"].values()
17+
assert "environment" not in jobs["prepare-artifacts"]
1718

1819
# These jobs can request the trusted-publishing identity. A venv would not
1920
# isolate dependency installation or repository code from that authority.

0 commit comments

Comments
 (0)