Add workflow to open esphome bump PR on release - #1862
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1862 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 26 26
Lines 4288 4288
=========================================
Hits 4288 4288 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to automatically bump aioesphomeapi in esphome/esphome immediately after an aioesphomeapi release is published (or via manual dispatch), by waiting for the new version to appear on PyPI, updating requirements.txt in the esphome repo, and opening/updating a draft PR on a reused branch.
Changes:
- Introduces a
release(published)+workflow_dispatchworkflow that derives the target version and waits for PyPI indexing. - Authenticates to
esphome/esphomevia a GitHub App token and updates theaioesphomeapipin inrequirements.txt. - Creates or updates a single draft PR in
esphome/esphomeusing the repo PR template and a stable head branch.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| old = os.environ["OLD"] | ||
| new = os.environ["VERSION"] | ||
| template = Path("esphome/.github/PULL_REQUEST_TEMPLATE.md").read_text() | ||
| description = ( | ||
| f"Bump aioesphomeapi from {old} to {new}, release notes: " | ||
| f"https://github.com/esphome/aioesphomeapi/releases/tag/v{new}" | ||
| ) | ||
| body = template.replace( | ||
| "<!-- Quick description and explanation of changes -->", description, 1 | ||
| ) | ||
| body = body.replace("- [ ] Other", "- [x] Other", 1) | ||
| Path("pr_body.md").write_text(body) |
| title="Bump aioesphomeapi from $OLD to $VERSION" | ||
| existing=$(gh pr list --repo esphome/esphome --head bump-aioesphomeapi --state open --json number --jq '.[].number') | ||
| if [[ -n "$existing" ]]; then | ||
| gh pr edit "$existing" --repo esphome/esphome --title "$title" --body-file pr_body.md |
| git checkout -b bump-aioesphomeapi | ||
| git commit -am "Bump aioesphomeapi from $OLD to $VERSION" | ||
| git push --force origin bump-aioesphomeapi |
|
Warning Review limit reached
Next review available in: 29 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR adds a GitHub Actions workflow that resolves an ChangesESPHome dependency bump
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant PyPI
participant GitHubApp
participant ESPHomeRepository
participant GitHubPullRequestAPI
GitHubActions->>GitHubActions: Resolve target version
GitHubActions->>PyPI: Poll aioesphomeapi version
PyPI-->>GitHubActions: Confirm indexed version
GitHubActions->>GitHubApp: Create repository token
GitHubActions->>ESPHomeRepository: Check out dev and update requirements.txt
GitHubActions->>ESPHomeRepository: Commit and force-push branch
GitHubActions->>GitHubPullRequestAPI: Update or create draft pull request
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/bump-esphome.yml:
- Around line 101-105: Update the workflow’s PR body generation to replace the
ESPHome PR reference placeholder with the PR number returned by gh pr create,
then write the updated body before editing or creating the PR. For the
existing-PR path, use the existing PR number in the replacement before invoking
gh pr edit; ensure both body-generation paths remove the placeholder.
- Around line 32-43: Update the PyPI polling loop in the “Wait for PyPI to index
the release” step to add curl connection and total transfer time limits using
--connect-timeout and --max-time, ensuring each request remains bounded within
the intended 45-minute retry window.
- Around line 16-17: Update the workflow containing the bump-esphome job to
serialize shared-branch updates with a workflow-level concurrency group named
for bump-aioesphomeapi and queue mode max. Add a stale-version check if releases
must be processed in order. Bound the PyPI polling curl request with connect and
total timeouts, and remove or replace the unresolved esphome PR-number
placeholder from generated PR bodies.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 41d316c4-d1ee-418c-aa74-11df32b30bc3
📒 Files selected for processing (1)
.github/workflows/bump-esphome.yml
| bump-esphome: | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
file=".github/workflows/bump-esphome.yml"
if [ -f "$file" ]; then
wc -l "$file"
cat -n "$file"
else
echo "Missing file: $file"
git ls-files | rg '(^|/)bump-esphome\.yml$|bump-aioesphomeapi|pull_request_template'
fi
printf '\nRelated references:\n'
rg -n --hidden -g '!node_modules' -g '!dist' -g '!build' \
'bump-aioesphomeapi|concurrency:|force-push|workflow_dispatch|pull request|pull_request|aioesphomeapi' \
.github README.md 2>/dev/null || trueRepository: esphome/aioesphomeapi
Length of output: 10886
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re
p = Path(".github/workflows/bump-esphome.yml")
text = p.read_text()
checks = {
"has_concurrency": bool(re.search(r"(?m)^concurrency\s*:", text)),
"checks_out_dev": bool(re.search(r"(?m)^\s*ref:\s*dev\s*$", text)),
"creates_shared_branch": "git checkout -b bump-aioesphomeapi" in text,
"force_pushes_shared_branch": "git push --force origin bump-aioesphomeapi" in text,
"edits_shared_pr": "gh pr edit" in text,
"lists_open_shared_pr": "--head bump-aioesphomeapi --state open" in text,
"curl_has_timeout": bool(re.search(r"(?m)^\s*if curl\b[^\n]*--max-time|^\s*if curl\b[^\n]*--connect-timeout", text)),
}
for name, value in checks.items():
print(f"{name}={value}")
print("poll_attempts=90")
print("sleep_seconds=30")
PYRepository: esphome/aioesphomeapi
Length of output: 488
🌐 Web query:
site:docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions concurrency pending one running one pending cancel-in-progress
💡 Result:
The terms "one running," "one pending," and "cancel-in-progress" refer to the concurrency control mechanisms used in GitHub Actions workflows [1]. When you define a concurrency group, GitHub Actions ensures that only one workflow or job with that specific key is in progress at any given time [1]. The behavior of queued jobs depends on your configuration: One Running, One Pending: By default, when a workflow or job with a concurrency group is already running, any new job with the same concurrency key will enter a "pending" state [1]. It waits until the currently running job completes. By default, if another job is already "pending" in that group, it will be canceled to make room for the newest job [1]. Cancel-in-Progress: If you set cancel-in-progress: true within your concurrency configuration, GitHub Actions will automatically cancel any existing job or workflow that is currently running in the same concurrency group when a new job with that key is triggered [1]. This effectively stops the older task to allow the newer one to take its place immediately, rather than waiting for the previous one to finish [1]. You can define this in your workflow file as follows: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true This configuration ensures that only the latest version of the job or workflow runs for a given reference or branch [1].
Citations:
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re
p = Path(".github/workflows/bump-esphome.yml")
text = p.read_text()
checks = {
"has_concurrency": bool(re.search(r"(?m)^concurrency\s*:", text)),
"checks_out_dev": bool(re.search(r"(?m)^\s*ref:\s*dev\s*$", text)),
"creates_shared_branch": "git checkout -b bump-aioesphomeapi" in text,
"force_pushes_shared_branch": "git push --force origin bump-aioesphomeapi" in text,
"edits_shared_pr": "gh pr edit" in text,
"lists_open_shared_pr": "--head bump-aioesphomeapi --state open" in text,
"curl_has_timeout": bool(re.search(
r"(?m)^\s*if curl\b[^\n]*(?:--max-time|--connect-timeout)", text
)),
}
for name, value in checks.items():
print(f"{name}={value}")
print("poll_attempts=90")
print("sleep_seconds=30")
PYRepository: esphome/aioesphomeapi
Length of output: 488
🏁 Script executed:
#!/bin/bash
set -eu
file=".github/workflows/bump-esphome.yml"
printf 'has_concurrency='
if grep -Eq '^concurrency[[:space:]]*:' "$file"; then echo true; else echo false; fi
printf 'checks_out_dev='
if grep -Eq '^[[:space:]]+ref:[[:space:]]*dev[[:space:]]*$' "$file"; then echo true; else echo false; fi
printf 'creates_shared_branch='
if grep -Fq 'git checkout -b bump-aioesphomeapi' "$file"; then echo true; else echo false; fi
printf 'force_pushes_shared_branch='
if grep -Fq 'git push --force origin bump-aioesphomeapi' "$file"; then echo true; else echo false; fi
printf 'updates_shared_pr='
if grep -Fq -- '--head bump-aioesphomeapi --state open' "$file" &&
grep -Fq 'gh pr edit' "$file"; then echo true; else echo false; fi
printf 'poll_attempts='
sed -n '36p' "$file" | sed -E 's/.*seq 1 ([0-9]+).*/\1/'
printf 'sleep_seconds='
sed -n '40p' "$file" | sed -E 's/.*sleep ([0-9]+).*/\1/'Repository: esphome/aioesphomeapi
Length of output: 325
🌐 Web query:
site:docs.github.com/actions concurrency "queue" "max" GitHub Actions
💡 Result:
In GitHub Actions, the maximum number of jobs or workflow runs that can be in a pending state within a concurrency group is determined by the queue property [1][2]. When using the concurrency keyword in your workflow, you can set the queue property as follows: * single (default): At most one job or workflow run can be in a pending state at a time [1][2]. If a new job is queued, the existing pending job is canceled and replaced [1][2]. * max: Up to 100 jobs or workflow runs can be in a pending state at a time [1][2]. Once this queue limit of 100 is reached, any additional jobs or workflow runs are canceled [1][2]. Note that the queue: max configuration cannot be combined with cancel-in-progress: true, as they represent conflicting strategies for handling concurrent runs [1][2]. If you attempt to use them together, it will cause a workflow validation error [1][2].
Citations:
- 1: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
- 2: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions
🏁 Script executed:
#!/bin/bash
set -eu
file=".github/workflows/bump-esphome.yml"
printf 'has_concurrency_matches='; grep -Ec '^concurrency[[:space:]]*:' "$file" || true
printf 'checkout_dev_matches='; grep -Ec '^[[:space:]]+ref:[[:space:]]*dev[[:space:]]*$' "$file" || true
printf 'shared_branch_creation_matches='; grep -Fc 'git checkout -b bump-aioesphomeapi' "$file" || true
printf 'shared_force_push_matches='; grep -Fc 'git push --force origin bump-aioesphomeapi' "$file" || true
printf 'shared_pr_lookup_matches='; grep -Fc -- '--head bump-aioesphomeapi --state open' "$file" || true
printf 'pr_edit_matches='; grep -Ec '^[[:space:]]*gh pr edit ' "$file" || true
printf 'curl_timeout_options='; grep -Eo -- '--(max-time|connect-timeout|retry-max-time)[[:space:]]+[0-9]+' "$file" | tr '\n' ' '; echo
printf '\nTemplate:\n'
cat -n .github/PULL_REQUEST_TEMPLATE.md
printf '\nBody replacements:\n'
grep -nE 'template\.replace|Quick description|Other|api\.proto|linked pull request' "$file" .github/PULL_REQUEST_TEMPLATE.md || trueRepository: esphome/aioesphomeapi
Length of output: 2695
🌐 Web query:
site:docs.github.com/actions "Concurrency group ordering is not guaranteed" OR "ordering is not guaranteed" concurrency
💡 Result:
In the context of GitHub Actions, the statement that "concurrency group ordering is not guaranteed" refers to how jobs or workflow runs within the same concurrency group are processed [1][2]. While GitHub Actions processes jobs or workflow runs in the same concurrency group using a first-in-first-out (FIFO) approach based on the time each one starts waiting on the concurrency group, the actual execution order is not guaranteed [1][2]. This is because the specific start time of a job or run can vary due to infrastructure factors [1][2]. For clarity, the concurrency group feature allows you to define a string or expression to ensure that only a single job or workflow with that specific key runs at any given time [2]. If new jobs or workflow runs are triggered with the same concurrency key, the system places them into a queue (or cancels existing ones depending on the configuration) [2]. The "not guaranteed" aspect strictly pertains to the precise execution sequence of these queued items [1][2].
Citations:
- 1: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
- 2: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions
Serialize shared-branch updates and bound PyPI polling.
- Add a workflow-level concurrency group for
bump-aioesphomeapiwithqueue: max. Concurrency does not guarantee release order, so add a stale-version check if every release must be processed in order. - Add
--connect-timeoutand--max-timeto the PyPIcurlrequest. The current polling loop does not bound a stalled request. - Remove or replace the unresolved
esphome/esphome#<esphome PR number goes here>placeholder in generated PR bodies.
🤖 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/bump-esphome.yml around lines 16 - 17, Update the workflow
containing the bump-esphome job to serialize shared-branch updates with a
workflow-level concurrency group named for bump-aioesphomeapi and queue mode
max. Add a stale-version check if releases must be processed in order. Bound the
PyPI polling curl request with connect and total timeouts, and remove or replace
the unresolved esphome PR-number placeholder from generated PR bodies.
| body = template.replace( | ||
| "<!-- Quick description and explanation of changes -->", description, 1 | ||
| ) | ||
| body = body.replace("- [ ] Other", "- [x] Other", 1) | ||
| Path("pr_body.md").write_text(body) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fill the required ESPHome PR reference.
The generated body replaces only the description and Other checklist item. It leaves esphome/esphome#<esphome PR number goes here> in the target template.
After gh pr create returns its PR number, replace the placeholder and update the body. For an existing PR, use $existing before gh pr edit.
Also applies to: 132-137
🤖 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/bump-esphome.yml around lines 101 - 105, Update the
workflow’s PR body generation to replace the ESPHome PR reference placeholder
with the PR number returned by gh pr create, then write the updated body before
editing or creating the PR. For the existing-PR path, use the existing PR number
in the replacement before invoking gh pr edit; ensure both body-generation paths
remove the placeholder.
PR Review — Add workflow to open esphome bump PR on releaseWell-built workflow — one blocking gap (missing The security and plumbing work here is genuinely careful, and several things I expected to be wrong check out:
What needs attention:
Note on prior bot feedback: @coderabbitai's suggestion to substitute "the ESPHome PR number" into the body is off-target — those placeholders in esphome's template are for documentation PRs (esphome.io / developers.esphome.io), not for the bump PR's own number. The "Pull request in esphome" placeholder it has in mind lives in this repo's template, which is not the one being rendered. 🟡 Important
1. No concurrency group — back-to-back releases race the shared branch and can leave esphome pinned to the older version
|
esphbot
left a comment
There was a problem hiding this comment.
Warning
Important issues found.
- No concurrency group — back-to-back releases race the shared branch and can leave esphome pinned to the older version
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
workflow=$(fd -a '^bump-esphome\.yml$' .github/workflows | head -n1)
if [ -z "$workflow" ]; then
echo "Workflow not found"
exit 1
fi
echo "== Workflow outline =="
ast-grep outline "$workflow" --items all || true
echo "== Relevant workflow lines =="
rg -n -C 8 'PULL_REQUEST_TEMPLATE|template|replace\(|gh pr (create|edit|list)|bump-aioesphomeapi|concurrency|curl|sed -i' "$workflow"
echo "== CodeRabbit review comments =="
gh api 'repos/esphome/aioesphomeapi/pulls/1862/comments?per_page=100' \
--jq '.[] | select(.user.login == "coderabbitai") | {id, path, line, body}'Length of output: 4590
The documentation placeholders must remain unrelated to the generated bump PR number. No CodeRabbit inline review comment was returned for PR The shell output also confirms the remaining workflow hardening findings: no You are interacting with an AI system. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.github/workflows/bump-esphome.yml (2)
130-132: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftProtect human commits on the shared branch.
git push --forcecan discard commits added tobump-aioesphomeapiafter checkout, including fixes made while the draft PR is under review.Fetch the remote branch first. Build on its tip or fail when it contains non-automation commits. Use an explicit
--force-with-leasefor the final update.🤖 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/bump-esphome.yml around lines 130 - 132, Update the bump-aioesphomeapi workflow around the branch checkout and push to fetch the remote branch first, preserve or validate commits added after checkout, and fail if it contains non-automation commits. Replace the unconditional force push with an explicit --force-with-lease using the fetched remote state for the final update.
28-32: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winUse a PEP 440-aware version comparison.
The release job skips prereleases, but manual input accepts them.
sort -Vorders45.8.0rc1after45.8.0, which can update or skip the wrongrequirements.txtpin. Reject unsupported versions or compare them withpackaging.version.Version.🤖 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/bump-esphome.yml around lines 28 - 32, Update the version handling around INPUT_VERSION and TAG_NAME to validate and compare versions using PEP 440 semantics, such as packaging.version.Version, rather than sort -V. Ensure prerelease inputs are handled consistently with release tags, and reject unsupported or invalid version formats before modifying the requirements pin.Source: MCP tools
🧹 Nitpick comments (1)
.github/workflows/bump-esphome.yml (1)
88-88: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winPreserve trailing requirement metadata.
This replacement rewrites the complete line as
aioesphomeapi==$VERSION. If the requirement later gains an environment marker, inline comment, or hash suffix, the workflow deletes it.Replace only the version token and retain the suffix.
Proposed replacement
- sed -i "s/^aioesphomeapi==.*/aioesphomeapi==$VERSION/" requirements.txt + sed -i -E "s|^(aioesphomeapi==)[^[:space:]]+(.*)$|\1$VERSION\2|" requirements.txt🤖 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/bump-esphome.yml at line 88, Update the sed command in the workflow to replace only the aioesphomeapi version token, preserving any trailing environment marker, inline comment, or hash suffix on the requirement line. Keep the existing VERSION value and package matching behavior unchanged.
🤖 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/bump-esphome.yml:
- Around line 142-144: Update the existing PR lookup in the bump workflow to use
the REST API with an owner-qualified head filter,
`head=esphome:bump-aioesphomeapi`, and `per_page=1`; preserve extracting the
matching PR number into `existing` and editing it with `gh pr edit`.
---
Outside diff comments:
In @.github/workflows/bump-esphome.yml:
- Around line 130-132: Update the bump-aioesphomeapi workflow around the branch
checkout and push to fetch the remote branch first, preserve or validate commits
added after checkout, and fail if it contains non-automation commits. Replace
the unconditional force push with an explicit --force-with-lease using the
fetched remote state for the final update.
- Around line 28-32: Update the version handling around INPUT_VERSION and
TAG_NAME to validate and compare versions using PEP 440 semantics, such as
packaging.version.Version, rather than sort -V. Ensure prerelease inputs are
handled consistently with release tags, and reject unsupported or invalid
version formats before modifying the requirements pin.
---
Nitpick comments:
In @.github/workflows/bump-esphome.yml:
- Line 88: Update the sed command in the workflow to replace only the
aioesphomeapi version token, preserving any trailing environment marker, inline
comment, or hash suffix on the requirement line. Keep the existing VERSION value
and package matching behavior unchanged.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 38e039ce-5727-4a35-9036-fc1c387d11d1
📒 Files selected for processing (1)
.github/workflows/bump-esphome.yml
| existing=$(gh pr list --repo esphome/esphome --base dev --head bump-aioesphomeapi --state open --json number --jq '.[0].number // empty') | ||
| if [[ -n "$existing" ]]; then | ||
| gh pr edit "$existing" --repo esphome/esphome --title "$title" --body-file pr_body.md |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- workflow context ---'
sed -n '1,180p' .github/workflows/bump-esphome.yml
printf '%s\n' '--- gh usage in workflow ---'
rg -n -C 3 'gh pr list|gh api|gh pr edit|bump-aioesphomeapi|git push' .github/workflows/bump-esphome.ymlRepository: esphome/aioesphomeapi
Length of output: 6221
🏁 Script executed:
#!/bin/bash
set -eu
sed -n '1,180p' .github/workflows/bump-esphome.yml
rg -n -C 3 'gh pr list|gh api|gh pr edit|bump-aioesphomeapi|git push' .github/workflows/bump-esphome.ymlRepository: esphome/aioesphomeapi
Length of output: 6167
🌐 Web query:
GitHub CLI gh pr list --head branch name fork pull requests --repo semantics and GitHub REST list pull requests head owner:branch per_page
💡 Result:
For the GitHub CLI and GitHub REST API, filtering pull requests by head branch uses different syntax and capabilities: GitHub CLI (gh pr list) The gh pr list command uses the --head flag to filter pull requests by the head branch name [1][2]. Syntax: gh pr list --head [1][3] Important Limitation: As of the latest documentation, the --head flag does not support the username:branch syntax (e.g., --head owner:branch is not supported) [1][4][5]. Users should provide only the branch name [1][3]. GitHub REST API (List pull requests) The GitHub REST API endpoint GET /repos/{owner}/{repo}/pulls allows filtering by head branch using the head query parameter [6][7]. Syntax: head=: [6][7] Requirement: For cross-repository pull requests within the same network, you must namespace the head branch with the username (e.g., octocat:test-branch) [6][8][9]. Summary Comparison Feature | GitHub CLI (gh pr list --head) | GitHub REST API (head parameter) --- | --- | --- Supported Syntax | | : Namespace Support | Not supported | Required for cross-repo PRs Primary Use | Command line filtering | Programmatic API integration Sources: [1][4][5][6][7][3]
Citations:
- 1: https://cli.github.com/manual/gh_pr_list
- 2: https://manpages.debian.org/bookworm/gh/gh-pr-list.1.en.html
- 3: https://man.archlinux.org/man/gh-pr-list.1.en.raw
- 4: https://man.archlinux.org/man/gh-pr-list.1.en
- 5: Add example usage of
--headoption topr listdocs cli/cli#10979 - 6: https://docs.github.com/en/rest/pulls/pulls
- 7: https://docs.github.com/en/rest/pulls/pulls?apiVersion=2026-03-10
- 8: https://docs.github.com/en/enterprise-cloud@latest/rest/pulls/pulls
- 9: https://docs.github.com/en/enterprise-server@3.21/rest/pulls/pulls
Use an owner-qualified head filter.
gh pr list --head bump-aioesphomeapi can match pull requests from forks. If a fork pull request is returned first, gh pr edit updates the wrong pull request. Use the REST API with head=esphome:bump-aioesphomeapi and per_page=1.
🤖 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/bump-esphome.yml around lines 142 - 144, Update the
existing PR lookup in the bump workflow to use the REST API with an
owner-qualified head filter, `head=esphome:bump-aioesphomeapi`, and
`per_page=1`; preserve extracting the matching PR number into `existing` and
editing it with `gh pr edit`.
Source: MCP tools
What does this implement/fix?
Adds a workflow that runs when a release is published; it waits for PyPI to index the new version, then updates the aioesphomeapi pin in esphome/esphome requirements.txt and opens a draft PR there, so the bump lands right away instead of waiting for the next dependabot run. It authenticates with the ESPHome GitHub App, fills in the esphome PR template at runtime, and reuses a single branch so back to back releases update the existing PR instead of opening duplicates. Also supports workflow_dispatch with a version input for manual runs.
Uses the org level ESPHOME_GITHUB_APP_CLIENT_ID variable and ESPHOME_GITHUB_APP_PRIVATE_KEY secret, already available to all org repos, same setup as device-builder-frontend.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome (if applicable):
Checklist:
tests/folder).