Deepak/path filter include#209
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates several GitHub Actions workflow examples (triggers/filters, jobs/steps, step types) and adds Devbox virtualenv/Poetry hook scripts to support local developer environment setup.
Changes:
- Adjusted the triggers/filters workflow (including a commented schedule example) and path filtering for PR events.
- Expanded the jobs/steps workflow by adding new jobs and new
needsdependencies. - Added Devbox hook scripts for Python venv creation/validation and Poetry environment selection.
Reviewed changes
Copilot reviewed 2 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| 03-core-features/filters/excluded-file.txt | Listed as part of the PR’s changed files (intended as an example artifact for path filtering). |
| .github/workflows/03-core-features--04-triggers-and-filters.yaml | Updates PR path filters and tweaks the commented schedule example formatting. |
| .github/workflows/03-core-features--03-workflows-jobs-steps.yaml | Adds new jobs and dependencies to demonstrate job relationships in a workflow DAG. |
| .github/workflows/03-core-features--02-step-types.yaml | Updates example output strings for inline bash/python and action input text. |
| .devbox/virtenv/python312/bin/venvShellHook.sh | Introduces a shell hook to validate/create a Python venv and handle non-Devbox venvs. |
| .devbox/virtenv/poetry/bin/initHook.sh | Adds a Poetry init hook to select the Python interpreter for a given pyproject directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule | ||
| # schedule: | ||
| # - cron: "0 0 * * *" # Midnight UTC | ||
| # - cron: "0 0 * * *" # Midnight UTC |
There was a problem hiding this comment.
The commented schedule example is mis-indented: # - cron: ... is shown under # schedule: with extra indentation, so if someone uncomments it they’ll end up with invalid YAML. Adjust the comment indentation to match the actual structure (e.g., keep the - cron aligned under schedule:).
| # - cron: "0 0 * * *" # Midnight UTC | |
| # - cron: "0 0 * * *" # Midnight UTC |
| #!/bin/sh | ||
| set -eu | ||
| STATE_FILE="$DEVBOX_PROJECT_ROOT/.devbox/venv_check_completed" |
There was a problem hiding this comment.
PR description focuses on path filters/triggers, but this PR also introduces Devbox virtualenv/Poetry hook scripts and modifies other workflow examples. Consider updating the PR description to reflect the broader scope or splitting these unrelated changes into separate PRs to keep review/rollback safer.
| needs: | ||
| - job-1 | ||
| - job-2 | ||
| - job-5 # a new job to explore the realtion and working of the jobs in a workflow |
There was a problem hiding this comment.
Typo in the inline comment: realtion should be relation.
| needs: | ||
| - job-5 # a new job to explore the realtion and working of the jobs in a workflow | ||
| steps: |
There was a problem hiding this comment.
job-5 is described as “independent”/able to run in parallel, but job-1 and job-3 now both need job-5, which makes it a prerequisite and changes the DAG/parallelism. Either drop the needs: [job-5] dependencies (if the goal is parallelism) or update the job description/comments to match the intended dependency behavior.
|
|
||
| create_venv() { | ||
| python -m venv "$VENV_DIR" --clear | ||
| echo "*\n.*" >> "$VENV_DIR/.gitignore" |
There was a problem hiding this comment.
echo "*\n.*" >> "$VENV_DIR/.gitignore" won’t reliably create a two-line .gitignore in POSIX sh (many echo implementations don’t interpret \n), and >> will append duplicates across runs. Use a portable approach (e.g., printf with real newlines) and overwrite the file rather than appending.
| echo "*\n.*" >> "$VENV_DIR/.gitignore" | |
| printf '%s\n' '*' '.*' > "$VENV_DIR/.gitignore" |
| @@ -0,0 +1,3 @@ | |||
| #!/bin/sh | |||
|
|
|||
| poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2 | |||
There was a problem hiding this comment.
--directory=... is a Poetry global option and typically must appear before the subcommand (e.g., poetry --directory ... env use ...). As written, poetry env use ... --directory=... may be ignored or error depending on Poetry version. Reorder the command to ensure it consistently targets the intended pyproject directory.
| poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2 | |
| poetry --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" env use $(command -v python) --no-interaction --quiet >&2 |
| job-1: | ||
| runs-on: ubuntu-24.04 | ||
| needs: | ||
| - job-5 # a new job to explore the realtion and working of the jobs in a workflow |
There was a problem hiding this comment.
Typo in the inline comment: realtion should be relation.
| jobs: | ||
| job-1: | ||
| runs-on: ubuntu-24.04 | ||
| needs: |
There was a problem hiding this comment.
There’s trailing whitespace after the needs: key (needs: ). This can trip YAML linters and makes diffs noisy; remove the extra space so it’s just needs:.
| needs: | |
| needs: |
| - run: echo "This is a second step in the new job of this workflow" | ||
|
|
||
| # By Deepak | ||
| job-6: |
There was a problem hiding this comment.
There’s trailing whitespace after the job id key (job-6: ). Removing it avoids whitespace-only diffs and potential YAML lint failures.
| job-6: | |
| job-6: |
| echo "Do you want to overwrite it? (y/n)" | ||
| read reply | ||
| echo |
There was a problem hiding this comment.
This hook prompts with read reply when the venv isn’t a Devbox venv. If this hook runs in a non-interactive context (e.g., devbox run / CI), it will block indefinitely. Consider detecting non-interactive stdin (or honoring an env var default) and failing fast or choosing a safe default behavior.
| echo "Do you want to overwrite it? (y/n)" | |
| read reply | |
| echo | |
| if [ "${DEVBOX_VENV_OVERWRITE:-}" != "" ]; then | |
| reply="$DEVBOX_VENV_OVERWRITE" | |
| elif [ -t 0 ]; then | |
| echo "Do you want to overwrite it? (y/n)" | |
| read reply | |
| echo | |
| else | |
| echo "ERROR: Non-interactive shell cannot prompt to overwrite $VENV_DIR." | |
| echo "Set DEVBOX_VENV_OVERWRITE=y to overwrite it, or DEVBOX_VENV_OVERWRITE=n to keep it." | |
| exit 1 | |
| fi |
A hands on for the Trigger Event for a specific type of file.