elastic / elastic/ai-github-actions
[product-manager-impersonator] PR head-ref preflight skip for stale branches
- Dominant language
- Python
- Stars
- 11
- Forks
- 16
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 31
Description
## Feature Idea
**Summary:** Add a lightweight preflight in PR-trigger workflows that checks whether the PR head ref still exists and cleanly skips the run when it does not.
## Why a Customer Would Want This
Teams running these workflows at scale get noisy failed runs when a PR branch is force-pushed, renamed, or deleted before the workflow executes. Instead of hard-failing on checkout, a deterministic skip keeps dashboards cleaner and reduces operator triage time.
## Rough Implementation Sketch
- Add a small preflight step/job in PR trigger workflows to verify `github.event.pull_request.head.ref` is fetchable (or resolvable via API) before invoking the reusable `gh-aw-*` workflow.
- If the ref is missing, emit a short skip/no-op message and end successfully.
- Apply this pattern to high-volume PR triggers first: `trigger-pr-review.yml`, `trigger-pr-labeler.yml`, `trigger-update-pr-body.yml`.
- Reuse the same guard pattern across other PR-triggered workflows if it proves effective.
## Why It Won't Be That Hard
This is a narrow change at the trigger layer only. The target workflows already centralize behavior behind reusable `gh-aw-*.lock.yml` jobs, so adding one shared preflight condition in trigger files is low-risk and avoids touching model prompts or core agent runtime logic.
## Evidence
- `.github/workflows/trigger-pr-labeler.yml:15-17` directly invokes `gh-aw-pr-labeler.lock.yml` without a head-ref existence preflight.
- `.github/workflows/trigger-update-pr-body.yml:14-17` directly invokes `gh-aw-update-pr-body.lock.yml` without a head-ref existence preflight.
- `.github/workflows/trigger-pr-review.yml:15-20` directly invokes `gh-aw-pr-review.lock.yml` without a head-ref existence preflight.
- Open issue `#744` documents repeated failures from missing remote refs (`fatal: couldn't find remote ref ...`, checkout exit 128) affecting these same trigger classes.
- Recent operational direction in this repo emphasizes workflow robustness and safe automation chaining (`docs/upgrading.md:28-33`, `docs/upgrading.md:35-48`).
---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Product Manager Impersonator](https://github.com/elastic/ai-github-actions/actions/runs/23290004937)
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
Contributor guide
Assessment
This issue has not been assessed yet.