Repository navigation
Description
Summary
The test workflow's pull_request trigger excludes .github/** and
root dotfiles, so a pull request that only changes the test workflow
never runs it. The filter was added deliberately in 29b386d to save CI
on Dependabot pull requests; the same change was declined for
actions-template (lfreleng-actions/actions-template#182), which has
no path filter. Two validation steps also rely
on an uninitialised ERROR variable.
Details
Path filter skips changes to the tests themselves
python-project-name-action/.github/workflows/testing.yaml
Lines 13 to 19 in 13f69c9
| pull_request: | |
| branches: ["main"] | |
| paths: | |
| - '**' | |
| - '!.github/**' | |
| - '!.*' | |
| - '!tox.ini' |
pull_request:
branches: ["main"]
paths:
- '**'
- '!.github/**'
- '!.*'
- '!tox.ini'A pull request whose changes are all under .github/ (including
.github/workflows/testing.yaml), in root dotfiles such as
.pre-commit-config.yaml, or in tox.ini, matches no included path,
so the workflow does not run. Edits to the tests are therefore merged
without the edited tests ever having run. If this job is a required
status check (not verified), such pull requests would also sit waiting
for a check that never starts.
The current template triggers on the branch alone:
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]ERROR is not initialised in the first two validation steps
python-project-name-action/.github/workflows/testing.yaml
Lines 64 to 99 in 13f69c9
| run: | | |
| # Validate Action Output | |
| project_file="$PROJECT_FILE" | |
| if [ "$project_file" != "pyproject.toml" ]; then | |
| echo "Unexpected return value for: python_project_file ❌" | |
| echo "Returned: $project_file" | |
| echo "Expected: pyproject.toml" | |
| ERROR="true" | |
| fi | |
| project_name="$PROJECT_NAME" | |
| if [ "$project_name" != "lfreleng-test-python-project" ]; then | |
| echo "Unexpected return value for: python_project_name ❌" | |
| echo "Returned: $project_name" | |
| echo "Expected: lfreleng-test-python-project" | |
| ERROR="true" | |
| fi | |
| package_name="$PACKAGE_NAME" | |
| if [ "$package_name" != "lfreleng_test_python_project" ]; then | |
| echo "Unexpected return value for: python_package_name ❌" | |
| echo "Returned: $package_name" | |
| echo "Expected: lfreleng_test_python_project" | |
| ERROR="true" | |
| fi | |
| source="$SOURCE" | |
| if [ "$source" != "pyproject.toml" ]; then | |
| echo "Unexpected return value for: source ❌" | |
| echo "Returned: $source" | |
| echo "Expected: pyproject.toml" | |
| ERROR="true" | |
| fi | |
| if [ "$ERROR" != "true" ]; then | |
| echo "All output tests passed for test-python-project ✅" | |
| else | |
| echo "At least one output test failed for test-python-project ❌" | |
| exit 1 | |
| fi |
python-project-name-action/.github/workflows/testing.yaml
Lines 122 to 157 in 13f69c9
| run: | | |
| # Validate Action Output | |
| project_file="$PROJECT_FILE" | |
| if [ "$project_file" != "pyproject.toml" ]; then | |
| echo "Unexpected return value for: python_project_file ❌" | |
| echo "Returned: $project_file" | |
| echo "Expected: pyproject.toml" | |
| ERROR="true" | |
| fi | |
| project_name="$PROJECT_NAME" | |
| if [ "$project_name" != "python-nss-ng" ]; then | |
| echo "Unexpected return value for: python_project_name ❌" | |
| echo "Returned: $project_name" | |
| echo "Expected: python-nss-ng" | |
| ERROR="true" | |
| fi | |
| package_name="$PACKAGE_NAME" | |
| if [ "$package_name" != "python_nss_ng" ]; then | |
| echo "Unexpected return value for: python_package_name ❌" | |
| echo "Returned: $package_name" | |
| echo "Expected: python_nss_ng" | |
| ERROR="true" | |
| fi | |
| source="$SOURCE" | |
| if [ "$source" != "pyproject.toml" ]; then | |
| echo "Unexpected return value for: source ❌" | |
| echo "Returned: $source" | |
| echo "Expected: pyproject.toml" | |
| ERROR="true" | |
| fi | |
| if [ "$ERROR" != "true" ]; then | |
| echo "All output tests passed for python-nss-ng ✅" | |
| else | |
| echo "At least one output test failed for python-nss-ng ❌" | |
| exit 1 | |
| fi |
Both steps set ERROR="true" on a mismatch and finish with
if [ "$ERROR" != "true" ], but never set ERROR="" first. The later
steps do
(L195,
L247, L306). Today this works because nothing exports ERROR, but a
workflow- or job-level ERROR variable would leak into these checks
and make them fail regardless of the action's output.
Suggested fix
- Remove the
paths:block from thepull_requesttrigger to match
the current template. - Add
ERROR=""at the top of the two validation scripts, as the later
steps already do.
Activity
Test: Run tests on every PR and reset ERROR