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
3 changes: 2 additions & 1 deletion .github/workflows/update-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:

permissions:
contents: write
issues: read
pull-requests: write

jobs:
Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:

git push -f origin update-framework

PR_NUMBER=$(gh pr list --head update-framework --json number --jq '.[0].number // empty')
PR_NUMBER=$(gh pr list --head "update-framework" --state open --template '{{range .}}{{ .number }}{{end}}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that lookup is restricted to the workflow's target base and returns one number.
set -euo pipefail
base_branch="$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')"
pr_number="$(gh pr list --head update-framework --base "$base_branch" --state open --json number --jq '.[0].number')"
if [[ -n "$pr_number" && ! "$pr_number" =~ ^[0-9]+$ ]]; then
  echo "Invalid PR number: $pr_number" >&2
  exit 1
fi

Repository: wp-cli/wp-cli-bundle

Length of output: 158


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/update-framework.yml"

echo "== file outline =="
sed -n '1,180p' "$file" | nl -ba | sed -n '1,180p'

echo
echo "== nearby lines around the PR lookup =="
sed -n '68,84p' "$file" | nl -ba

Repository: wp-cli/wp-cli-bundle

Length of output: 217


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/update-framework.yml"

echo "== line count =="
wc -l "$file"

echo
echo "== relevant section =="
sed -n '1,140p' "$file" | awk '{printf "%4d  %s\n", NR, $0}'

echo
echo "== gh pr usage in this workflow =="
rg -n "gh pr (list|edit)|update-framework|default_branch|base_branch|base" "$file"

Repository: wp-cli/wp-cli-bundle

Length of output: 4723


Select only the PR for the workflow’s target base branch. gh pr list --head "update-framework" can match more than one open PR, and {{range .}}{{ .number }}{{end}} concatenates every number it finds. That can feed an invalid ID into gh pr edit or update the wrong PR. Add --base "${{ github.event.repository.default_branch }}" and select a single result.

🤖 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/update-framework.yml at line 76, Update the PR lookup
assigned to PR_NUMBER to filter by the repository’s default branch using the
workflow event’s default-branch value, and select only one matching open PR
instead of concatenating all results. Preserve the existing update-framework
head filter so subsequent gh pr edit operations receive a single valid PR
number.

if [ -z "$PR_NUMBER" ]; then
gh pr create \
--title "Update wp-cli framework" \
Expand Down
Loading