-
Notifications
You must be signed in to change notification settings - Fork 4
Add GitHub Actions workflow for Python application #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This workflow will install Python dependencies, run tests and lint with a single version of Python | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Python application | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: [ "main" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: [ "main" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Set up Python 3.10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-python@v3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| python-version: "3.10" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 💤 Low value 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh api repos/actions/setup-python/releases/latest --jq '.tag_name'Repository: genlayerlabs/unhardcoded Length of output: 169 🌐 Web query:
💡 Result: The actions/setup-python GitHub action released version 7.0.0 on July 20, 2026 [1][2]. Key information regarding this release includes: Migration to ESM: The action internals were migrated to ECMAScript Modules (ESM) to ensure compatibility with the latest Citations:
🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Workflow uses:"
rg -n "uses: actions/setup-python@" .github/workflows/python-app.yml || true
echo
echo "GitHub actionlint availability:"
command -v actionlint || true
echo
echo "workflow file context:"
cat -n .github/workflows/python-app.yml | sed -n '1,80p'Repository: genlayerlabs/unhardcoded Length of output: 1752 🌐 Web query:
💡 Result: The runner software version 2.327.1 is not the image version for the "ubuntu-latest" GitHub-hosted runner, but rather the version of the GitHub Actions runner application itself [1]. The GitHub Actions runner application (often referred to as the "runner version") is the agent that executes the workflow jobs [1]. As of July 2026, version 2.327.1 is a specific release of this application [1]. In contrast, the "ubuntu-latest" label refers to the underlying operating system image provided by GitHub [2]. As of July 29, 2026, the "ubuntu-latest" label points to the Ubuntu 24.04 LTS image [2]. These OS images are frequently updated with new software versions and maintain their own unique image versioning schemes, such as 20260726.254.1 for the Ubuntu 24.04 image [3]. Key Distinctions: - Runner Version (e.g., 2.327.1): Refers to the version of the software agent that runs your jobs [1]. - Image Version (e.g., 20260726.254.1): Refers to the specific build of the OS environment (including pre-installed tools and runtimes) currently in use [3]. - Workflow Label (e.g., ubuntu-latest): The alias used in your YAML configuration to request a specific type of environment [2]. Citations:
Upgrade
Proposed fix- uses: actions/setup-python@v3
+ uses: actions/setup-python@v6📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.12)[error] 23-23: the runner of "actions/setup-python@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pip install flake8 pytest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Lint with flake8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # stop the build if there are Python syntax errors or undefined names | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Make the full lint check fail on violations.
Proposed fix- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+ flake8 . --count --max-complexity=10 --max-line-length=127 --statistics📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Test with pytest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| pytest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+37
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Provision PostgreSQL before running pytest.
Example configuration jobs:
build:
+ services:
+ postgres:
+ image: postgres:16
+ env:
+ POSTGRES_PASSWORD: test
+ POSTGRES_DB: hoststore
+ ports:
+ - 55432:5432
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+
steps:
...
- name: Test with pytest
+ env:
+ DATABASE_URL: postgresql://postgres:test@localhost:55432/hoststore
run: |
pytest📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: genlayerlabs/unhardcoded
Length of output: 1770
🌐 Web query:
actions/checkout v4 persist-credentials default true README💡 Result:
In actions/checkout v4, the persist-credentials input has a default value of true [1][2][3]. When set to true, the action configures the authentication token or SSH key into the local Git configuration, allowing your workflow scripts to run authenticated Git commands (such as git push or git pull) [1][4]. The action automatically removes these credentials during the post-job cleanup phase [1][5]. To prevent the action from adding these credentials to the Git config, you can explicitly set persist-credentials: false in your workflow step [1][4].
Citations:
Disable checkout credential persistence.
actions/checkoutkeeps the token available in local Git config by default, and this job then installs dependencies and runs pytest, so the runner-scopedGITHUB_TOKENis unnecessarily exposed to the later steps.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.28.0)
[warning] 21-21: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools