elastic / elastic/ai-github-actions
[framework-best-practices] Use GitHub Actions native inputs for docs triggers and smoke-test temp state
- Dominant language
- Python
- Stars
- 11
- Forks
- 16
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 31
Description
## Framework / Library Best Practices Findings
### 1. Docs deployment path filter omits generated-page inputs
**Library:** GitHub Actions workflow path filters; MkDocs `mkdocs>=1.6.0,<2.0`
**Library feature:** GitHub Actions `on.push.paths` should include all source paths that affect the workflow output.
**Current code:** `.github/workflows/mkdocs.yml:4-9` only runs the Pages build for changes under `docs/**`, `mkdocs.yml`, and `docs/requirements.txt`. However `docs/hooks.py:81-114` reads each `gh-agent-workflows/*/README.md` and `example.yml`, and `docs/hooks.py:126-141` generates MkDocs pages from those files during the build.
**Simplification:** Add `gh-agent-workflows/**` to `.github/workflows/mkdocs.yml`'s `on.push.paths` so the native path filter matches the actual MkDocs input graph. Without this, changes to workflow READMEs or examples can merge without rebuilding the published Pages site.
**Documentation:** https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore and (www.mkdocs.org/redacted)
### 2. Smoke test hard-codes scratch state under `/tmp` instead of Actions-managed temp storage
**Library:** GitHub Actions runner context
**Library feature:** `runner.temp` provides a job-scoped temporary directory that Actions empties at the start and end of each job.
**Current code:** `.github/workflows/smoke-test-install.yml:29-38` creates `/tmp/test-repo` with `mkdir /tmp/test-repo` and then uses `/tmp/test-repo` as the working directory. `.github/workflows/smoke-test-install.yml:103-105` reuses the same hard-coded path for verification.
**Simplification:** Define a repo path from `${{ runner.temp }}`, for example `TEST_REPO: ${{ runner.temp }}/test-repo`, then use `mkdir -p "$TEST_REPO"`, `cd "$TEST_REPO"`, and `working-directory: ${{ env.TEST_REPO }}`. This keeps scratch state inside Actions-managed cleanup and avoids stale `/tmp/test-repo` causing scheduled smoke-test failures on any runner that preserves `/tmp` between jobs.
**Documentation:** https://docs.github.com/actions/learn-github-actions/contexts#runner-context
## Suggested Actions
- [ ] Add `gh-agent-workflows/**` to the docs workflow `on.push.paths` list.
- [ ] Replace `/tmp/test-repo` in `smoke-test-install.yml` with a path rooted at `${{ runner.temp }}` and reuse it for all smoke-test steps.
---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Framework Best Practices](https://github.com/elastic/ai-github-actions/actions/runs/27695366733)
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
Contributor guide
Research direction
Start by reading the path filters in .github/workflows/mkdocs.yml and the generated-page inputs in docs/hooks.py:81-114 and 126-141. Then inspect the /tmp/test-repo setup and verification steps in .github/workflows/smoke-test-install.yml:29-38 and 103-105. Done means workflow changes under gh-agent-workflows/** trigger docs builds and smoke-test scratch state consistently uses runner.temp.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- Half a day
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100