Skip to content

Test: PR path filter skips test changes; ERROR uninitialised #170

Closed

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

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:

https://github.com/lfreleng-actions/actions-template/blob/4860de5ad152637813b1080a822b6105b50b1d6d/.github/workflows/testing.yaml#L9-L14

on:
  workflow_dispatch:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

ERROR is not initialised in the first two validation steps

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

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 the pull_request trigger to match
    the current template.
  • Add ERROR="" at the top of the two validation scripts, as the later
    steps already do.

Activity

  1. added
    CI
    code-quality
    on Sep 26, 2026
  2. added a commit that references this issue on Oct 4, 2026
    912a930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIcode-quality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions