Repository navigation
Add GitHub Actions workflow for Python package - #7
Conversation
This workflow installs Python dependencies, runs linting with flake8, and executes tests with pytest across multiple Python versions.
PR Summary by QodoAdd GitHub Actions CI to lint and test Python package (3.9–3.11)
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
| - uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v3 |
There was a problem hiding this comment.
Mutable workflow action references
The workflow references actions/checkout@v4 and actions/setup-python@v3 through mutable tags, allowing the executed CI code to change without repository review. Pinning each action to a full commit SHA protects checked-out source and build integrity from a moved or compromised tag.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/python-package.yml
Line: 22-24
Comment:
**Mutable workflow action references**
The workflow references `actions/checkout@v4` and `actions/setup-python@v3` through mutable tags, allowing the executed CI code to change without repository review. Pinning each action to a full commit SHA protects checked-out source and build integrity from a moved or compromised tag.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Code Review by Qodo
1. Unpinned/outdated GH actions
|
| - uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v3 | ||
| with: |
There was a problem hiding this comment.
2. Unpinned/outdated gh actions 🐞 Bug ⛨ Security
The workflow uses mutable tag references for actions (e.g., checkout@v4 and setup-python@v3), which increases supply-chain risk and reduces build reproducibility. setup-python@v3 is also behind current major releases, missing fixes and improvements.
Agent Prompt
### Issue description
The workflow references GitHub Actions by mutable tags (e.g., `@v4`, `@v3`) rather than immutable commit SHAs, and uses an older major version of `actions/setup-python`.
### Issue Context
Mutable tags can move over time, changing what code executes in CI.
### Fix Focus Areas
- .github/workflows/python-package.yml[22-26]
### Suggested fix
- Upgrade `actions/setup-python` to a current major version.
- Pin third-party actions to commit SHAs (optionally keep the tag in a comment) and use Dependabot to keep pins updated.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
There was a problem hiding this comment.
3. Flake8 not enforced 🐞 Bug ⚙ Maintainability
The second flake8 invocation uses --exit-zero, so most lint violations won’t fail CI and the "Lint" step won’t enforce style/complexity constraints. Only the first, select-limited flake8 command can fail the build.
Agent Prompt
### Issue description
The workflow’s flake8 step uses `--exit-zero`, which forces success even when lint violations are found.
### Issue Context
The first flake8 command only checks a narrow set of error codes; the second command is where broader lint rules would normally be enforced.
### Fix Focus Areas
- .github/workflows/python-package.yml[32-37]
### Suggested fix
- Remove `--exit-zero` so lint violations fail the job, OR rename/split the step to clearly indicate that the second pass is advisory (e.g., upload as annotations) if non-blocking lint is intended.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install flake8 pytest | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
There was a problem hiding this comment.
4. Package not installed in ci 🐞 Bug ☼ Reliability
The workflow installs tools and requirements.txt but never installs the project itself, so CI won’t catch packaging issues (missing files in the wheel/sdist, dependency metadata drift, or the console-script entry point). This can allow releases that pass tests from a checkout but fail when installed by users.
Agent Prompt
### Issue description
CI runs pytest from the checked-out source tree without ever installing the project. This skips validation of packaging metadata and entry points.
### Issue Context
The project declares a console script (`fitbit2garmin`) in `pyproject.toml`, which should be validated as part of CI.
### Fix Focus Areas
- .github/workflows/python-package.yml[27-31]
- pyproject.toml[5-34]
### Suggested fix
- After installing dependencies, run one of:
- `python -m pip install -e .` (editable)
- or build and install a wheel in a clean env for stronger validation.
- Prefer installing dependencies from the project metadata (e.g., `pip install .`) rather than maintaining a separate requirements.txt as the single source of truth (unless requirements.txt is intentionally the canonical lock/source).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This workflow installs Python dependencies, runs linting with flake8, and executes tests with pytest across multiple Python versions.
Greptile Summary
The workflow now runs dependency installation, linting, and tests on the project’s supported Python 3.10 and 3.11 versions.
main.Confidence Score: 3/5
The PR should not merge until the still-mutable third-party action references are pinned to immutable commit SHAs.
The unsupported Python 3.9 entry has been removed, but both third-party actions still resolve through mutable tags, leaving the previously reported CI integrity issue outstanding.
Files Needing Attention: .github/workflows/python-package.yml
Important Files Changed
Reviews (2): Last reviewed commit: "Update .github/workflows/python-package...." | Re-trigger Greptile