elastic / elastic/ai-github-actions

[framework-best-practices] Broaden `ci-tests` path filters so pytest runs for tested source changes

Open
#1,049 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
16
Avg merge
22h 9m
Merged PRs (30d)
31

Description

## Framework / Library Best Practices Findings

### 1. `ci-tests` underuses GitHub Actions `paths` filtering and skips relevant pytest runs
**Library:** GitHub Actions workflow syntax (`on.pull_request.paths` / `on.push.paths`)

**Library feature:** Path filters that include all source locations covered by the workflow's test suite.

**Current code:**
- `.github/workflows/ci-tests.yml:4-13` only triggers on:
- `.github/workflows/gh-aw-fragments/**`
- `tests/**`
- `pyproject.toml`
- The same workflow runs `uv run --extra test pytest tests/ -v` (`.github/workflows/ci-tests.yml:25`), and those tests directly cover additional source locations, for example:
- `scripts/fetch-workflow-logs.py` (`tests/test_fetch_workflow_logs.py:6`)
- `scripts/extract-log-errors.py` (`tests/test_extract_log_errors.py:8`)
- `scripts/check-nav-catalog.py` (`tests/test_check_nav_catalog.py:9`)
- `docs/hooks.py` (`tests/test_docs_hooks.py:6`)
- `claude-workflows/.../scripts/*.sh` (`tests/test_review_thread_pagination.py:9-10`)

**What is wrong:**
Changes to these tested source files do not trigger `ci-tests` unless a test file also changes, so the repository can merge regressions in covered code without running the corresponding pytest job.

**Why it matters:**
This weakens CI coverage and increases risk of shipping broken scripts/workflow helpers. The workflow already has tests for these paths, but trigger filters prevent those tests from running when they are most needed.

**Simplification:**
Use GitHub Actions path filters to match the actual tested source surface so the existing pytest job runs automatically for relevant code changes.

**Documentation:**
https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore

## Suggested Actions
- [ ] Update `.github/workflows/ci-tests.yml` `on.pull_request.paths` and `on.push.paths` to include tested source locations (at minimum `scripts/**`, `docs/hooks.py`, and `claude-workflows/**`).
- [ ] Keep existing paths (`tests/**`, `.github/workflows/gh-aw-fragments/**`, `pyproject.toml`) and verify the resulting trigger set still avoids unnecessary runs while covering all code exercised by the pytest suite.

> [!NOTE]
>
> 🔒 Integrity filter blocked 1 item
>
> The following item were blocked because they don't meet the GitHub integrity level.
>
> - [#704](https://github.com/elastic/ai-github-actions/issues/704) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
>
> To allow these resources, lower `min-integrity` in your GitHub frontmatter:
>
> ```yaml
> tools:
> github:
> min-integrity: approved # merged | approved | unapproved | none
> ```
>
>

---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Framework Best Practices](https://github.com/elastic/ai-github-actions/actions/runs/25168570957)

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.