Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ jobs:
build:
permissions:
contents: read
pages: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out source
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- name: Validate and build site
- name: Validate site
run: python3 scripts/validate-pages-site.py
- name: Build deployment artifact
run: python3 scripts/build-pages-site.py
- name: Configure Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
with:
enablement: true
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
with:
Expand Down
11 changes: 8 additions & 3 deletions scripts/validate-hosted-workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ def main() -> int:
combined_pr_surface = texts["ci.yml"] + texts["pages.yml"]
if "secrets." in combined_pr_surface or "contents: write" in combined_pr_surface:
errors.append("pull-request or Pages surface can access secrets or write contents")
for phrase in ("pages: write", "enablement: true"):
if phrase not in texts["pages.yml"]:
errors.append(f"Pages workflow missing first-run control: {phrase}")
pages = texts["pages.yml"]
if pages.count("pages: write") != 1 or "enablement: true" in pages:
errors.append("Pages write permission must remain confined to deployment after activation")
validate_step = pages.find("python3 scripts/validate-pages-site.py")
build_step = pages.find("python3 scripts/build-pages-site.py")
upload_step = pages.find("actions/upload-pages-artifact@")
if min(validate_step, build_step, upload_step) < 0 or not validate_step < build_step < upload_step:
errors.append("Pages workflow must validate, build, then upload the deployment artifact")
if "ref: ${{ github.event.pull_request.head.sha || github.sha }}" not in texts["ci.yml"]:
errors.append("pull-request CI does not bind checkout to the exact head SHA")
release = texts["release.yml"]
Expand Down