Skip to content

Fix update-framework workflow when there is an existing PR#1083

Merged
swissspidy merged 1 commit into
mainfrom
fix/update-framework-workflow
Jul 21, 2026
Merged

Fix update-framework workflow when there is an existing PR#1083
swissspidy merged 1 commit into
mainfrom
fix/update-framework-workflow

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 21, 2026

Copy link
Copy Markdown
Member

See https://github.com/wp-cli/wp-cli-bundle/actions/runs/29848186175/job/88694048220 which caused me to look into this.

Summary by CodeRabbit

  • Chores
    • Updated automated framework maintenance workflow permissions.
    • Improved detection of existing update pull requests during automated maintenance.

@swissspidy swissspidy added the scope:testing Related to testing label Jul 21, 2026
@swissspidy
swissspidy requested a review from a team as a code owner July 21, 2026 16:31
@github-actions github-actions Bot added enhancement New feature or request scope:framework labels Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The framework update workflow now grants read access to issues and extracts an existing open pull request number using gh pr list template output.

Changes

Framework update workflow

Layer / File(s) Summary
Workflow permissions and PR detection
.github/workflows/update-framework.yml
Adds issues: read permission and changes existing pull request number extraction from JSON/JQ parsing to template output.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the workflow fix for handling an existing update-framework PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/update-framework-workflow

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In @.github/workflows/update-framework.yml:
- 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8abf7c32-4e9f-447d-bc1c-7d7e1747cea9

📥 Commits

Reviewing files that changed from the base of the PR and between dbda1d5 and a788282.

📒 Files selected for processing (1)
  • .github/workflows/update-framework.yml

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.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy
swissspidy merged commit 284528f into main Jul 21, 2026
68 checks passed
@swissspidy
swissspidy deleted the fix/update-framework-workflow branch July 21, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scope:framework scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant