Skip to content
Open
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
10 changes: 8 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
issue_comment:
types: [created]
workflow_call:
inputs:
is-release:
description: Whether this is invoked from the Release workflow (skip PR permission gating).
type: boolean
required: false
default: false
secrets:
SURGE_LOGIN:
required: true
Expand All @@ -23,7 +29,7 @@ jobs:
if: >-
always() &&
!cancelled() &&
(github.event_name == 'workflow_call' || needs.check-permissions.outputs.allowed == 'true')
(inputs.is-release || needs.check-permissions.outputs.allowed == 'true')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not deploy when the permission-check job fails.

Because always() is combined with inputs.is-release, a release deployment proceeds even if check-permissions fails. Require needs.check-permissions.result == 'success'; the release flag should bypass only the PR authorization result, not a failed permission check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/documentation.yml at line 32, Update the deployment
condition in the workflow to require needs.check-permissions.result == 'success'
for all deployments, while allowing inputs.is-release to bypass only the
authorization output check. Preserve the existing non-release permission
requirement and prevent deployment when the check-permissions job fails.

env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
Expand All @@ -39,7 +45,7 @@ jobs:
ref: refs/pull/${{ env.GH_PR_NUM }}/head

- name: Check out project
if: github.event_name == 'workflow_call'
if: inputs.is-release

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow files =="
git ls-files .github/workflows | sed -n '1,120p'

echo
echo "== documentation workflow =="
if [ -f .github/workflows/documentation.yml ]; then
  cat -n .github/workflows/documentation.yml
fi

echo
echo "== references to documentation workflow and input is-release =="
rg -n "documentation\.yml|--workflow|is-release|pull_request_target|issue_comment|permissions:" .github/workflows .github 2>/dev/null || true

Repository: patternfly/patternfly-react

Length of output: 4731


Cover reusable is-release: false call sites.

documentation.yml only auto-checks out pull_request_target and issue_comment; manual non-release reusable workflow calls get past permission gating but run without checkout. Add a fallback checkout guarded by (!github.event_name || inputs.is-release) or explicitly cover each supported caller.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/documentation.yml at line 48, Update the checkout
permission-gating logic in the documentation workflow so reusable calls with
is-release set to false still perform a checkout; add the fallback condition
(!github.event_name || inputs.is-release), or explicitly include every supported
non-release caller while preserving existing pull_request_target and
issue_comment behavior.

uses: actions/checkout@v4
- name: Set up and build project
uses: ./.github/actions/setup-project
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
docs:
name: Documentation
uses: ./.github/workflows/documentation.yml
with:
is-release: true
secrets: inherit

deploy:
Expand Down
Loading