Skip to content

Fix workflow entrypoint and script imports#2

Open
MahanKenway wants to merge 2 commits into
mainfrom
codex/find-issues-in-the-code-dw7u3v
Open

Fix workflow entrypoint and script imports#2
MahanKenway wants to merge 2 commits into
mainfrom
codex/find-issues-in-the-code-dw7u3v

Conversation

@MahanKenway
Copy link
Copy Markdown
Owner

Motivation

  • Ensure the collector runs reliably in CI and when invoked directly by resolving package imports and using a module entrypoint.

Description

  • Run the collector via python -m src.main in the GitHub Actions workflow so package imports resolve correctly in CI.
  • Update scripts/collector.py to prepend the repository root to sys.path before importing src.main so the script can be executed directly without import errors.

Testing

  • No automated tests were executed for this change; edits are limited to the workflow and the script entrypoint.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63f4d3de37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/collector.py
Comment on lines +4 to +7
ROOT_DIR = Path(__file__).resolve().parents[1]
sys.path.append(str(ROOT_DIR))

TELEGRAM_TOKEN = os.environ.get("TELEGRAM_TOKEN")
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID")
from src.main import main # noqa: E402
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prioritize repo root on sys.path for local imports

Appending the repo root with sys.path.append(...) puts it at the end of the import search path, so if the environment already has a third‑party package named src installed, from src.main import main can resolve to the wrong module. This can cause python scripts/collector.py to run unrelated code or fail only on machines with that package present. Use sys.path.insert(0, ...) or similar to ensure the local src package takes precedence.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant