Skip to content

Deepak/trigger events#207

Open
k-marian-deepak wants to merge 12 commits intosidpalas:mainfrom
k-marian-deepak:Deepak/Trigger-Events
Open

Deepak/trigger events#207
k-marian-deepak wants to merge 12 commits intosidpalas:mainfrom
k-marian-deepak:Deepak/Trigger-Events

Conversation

@k-marian-deepak
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 08:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables additional GitHub Actions triggers and expands the example workflows/devbox hooks to explore scheduling, job dependencies, and Python environment setup.

Changes:

  • Enabled the schedule trigger (daily cron) for the “Triggering Events” workflow.
  • Added new jobs and needs relationships to demonstrate workflow DAG behavior.
  • Added Devbox/Poetry hook scripts for Python 3.12 virtualenv handling and Poetry environment selection.

Reviewed changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
.github/workflows/03-core-features--04-triggers-and-filters.yaml Enables scheduled trigger and adjusts trigger section formatting.
.github/workflows/03-core-features--03-workflows-jobs-steps.yaml Adds jobs (job-5, job-6) and modifies dependency graph via needs.
.github/workflows/03-core-features--02-step-types.yaml Updates example step outputs / action input text.
.devbox/virtenv/python312/bin/venvShellHook.sh Adds a venv setup/validation hook with overwrite prompt and state marker.
.devbox/virtenv/poetry/bin/initHook.sh Adds Poetry init hook to select the interpreter for poetry env use.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# schedule:
# - cron: "0 0 * * *" # Midnight UTC
schedule:
- cron: "0 0 * * *" # Midnight UTC
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The schedule trigger is now enabled, which will run this workflow every day on the default branch even when there are no changes. If this repo isn’t meant to incur recurring Actions runs, consider keeping this commented out or using a less frequent cron (or relying on workflow_dispatch).

Suggested change
- cron: "0 0 * * *" # Midnight UTC
- cron: "0 0 * * 0" # Midnight UTC every Sunday

Copilot uses AI. Check for mistakes.
# - uses: actions/hello-world-javascript-action@v1 # This would work, but it would be less stable and less secure:
with:
who-to-greet: "from an action in the GitHub Action marketplace! 👋"
who-to-greet: "from an action in the GitHub Action marketplace! 👋 By Marian" No newline at end of file
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The greeting string now ends with “By Marian”, which looks inconsistent with the other additions in this PR and will be surfaced in workflow logs/output. If attribution is intended, make it consistent; otherwise remove the name to keep the example output generic.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +46
echo "Do you want to overwrite it? (y/n)"
read reply
echo
case "$reply" in
[Yy]) echo "Overwriting existing virtual environment..."
create_venv ;;
[Nn]) echo "Using your existing virtual environment. We recommend changing \$VENV_DIR to a different location"
touch "$STATE_FILE"
exit 0 ;;
*) echo "Invalid input. Exiting..."
exit 1 ;;
esac
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

This hook prompts interactively (read reply) when the venv isn’t using Devbox Python. If this hook can run in non-interactive contexts (CI/devbox scripts), it may hang. Consider making it non-interactive by default (fail with a clear message, or honor an env var like DEVBOX_NO_PROMPT=1 / CI=1 to auto-overwrite or auto-skip).

Suggested change
echo "Do you want to overwrite it? (y/n)"
read reply
echo
case "$reply" in
[Yy]) echo "Overwriting existing virtual environment..."
create_venv ;;
[Nn]) echo "Using your existing virtual environment. We recommend changing \$VENV_DIR to a different location"
touch "$STATE_FILE"
exit 0 ;;
*) echo "Invalid input. Exiting..."
exit 1 ;;
esac
if [ "${DEVBOX_OVERWRITE_VENV:-0}" = "1" ]; then
echo "Overwriting existing virtual environment because DEVBOX_OVERWRITE_VENV=1..."
create_venv
elif [ "${DEVBOX_KEEP_VENV:-0}" = "1" ]; then
echo "Using your existing virtual environment because DEVBOX_KEEP_VENV=1. We recommend changing \$VENV_DIR to a different location"
touch "$STATE_FILE"
exit 0
elif [ "${DEVBOX_NO_PROMPT:-0}" = "1" ] || [ -n "${CI:-}" ] || [ ! -t 0 ]; then
echo "Non-interactive mode detected; refusing to prompt before overwriting $VENV_DIR."
echo "Set DEVBOX_OVERWRITE_VENV=1 to overwrite automatically, or DEVBOX_KEEP_VENV=1 to keep the existing virtual environment."
exit 1
else
echo "Do you want to overwrite it? (y/n)"
read reply
echo
case "$reply" in
[Yy]) echo "Overwriting existing virtual environment..."
create_venv ;;
[Nn]) echo "Using your existing virtual environment. We recommend changing \$VENV_DIR to a different location"
touch "$STATE_FILE"
exit 0 ;;
*) echo "Invalid input. Exiting..."
exit 1 ;;
esac
fi

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,3 @@
#!/bin/sh

poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

poetry env use $(command -v python) uses command substitution without quoting. While paths are typically space-free, quoting avoids accidental word-splitting and is the safer pattern in shell scripts.

Suggested change
poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2
poetry env use "$(command -v python)" --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2

Copilot uses AI. Check for mistakes.
# schedule:
# - cron: "0 0 * * *" # Midnight UTC
schedule:
- cron: "0 0 * * *" # Midnight UTC
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

Indentation under schedule: is off by 2 spaces (- cron is indented further than other lists in this file, e.g. pull_request.types at lines 15–18). Align the list indentation so it’s consistently +2 spaces under its parent key (helps avoid YAML parsing surprises and keeps the style consistent).

Suggested change
- cron: "0 0 * * *" # Midnight UTC
- cron: "0 0 * * *" # Midnight UTC

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
needs:
- job-5 # a new job to explore the realtion and working of the jobs in a workflow
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

job-1 is declared as needing job-5, which forces job-1 to wait for job-5. This contradicts the later description that job-5 is “independent” and “can run in parallel”. Either remove this dependency or update the explanation/job text so the DAG behavior matches what the workflow demonstrates.

Suggested change
needs:
- job-5 # a new job to explore the realtion and working of the jobs in a workflow

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

Spelling: “realtion” should be “relation”.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +44
# By Deepak
job-5:
runs-on: ubuntu-24.04
steps:
- run: echo "This is a new job that I have added to this workflow which is independent of the other jobs and can run in parallel with them."
- run: echo "This is a second step in the new job of this workflow"

# By Deepak
job-6:
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

The added # By Deepak comments (and the trailing whitespace) introduce personal attribution into the workflow file. This tends to become noisy over time and isn’t actionable documentation; prefer relying on Git history/PRs, or replace with a functional comment describing why the job exists.

Suggested change
# By Deepak
job-5:
runs-on: ubuntu-24.04
steps:
- run: echo "This is a new job that I have added to this workflow which is independent of the other jobs and can run in parallel with them."
- run: echo "This is a second step in the new job of this workflow"
# By Deepak
job-6:
# Independent job used to demonstrate how `needs` can reference parallel jobs.
job-5:
runs-on: ubuntu-24.04
steps:
- run: echo "This is a new job that I have added to this workflow which is independent of the other jobs and can run in parallel with them."
- run: echo "This is a second step in the new job of this workflow"
# Another independent job that can run in parallel with the rest of the workflow.
job-6:

Copilot uses AI. Check for mistakes.

create_venv() {
python -m venv "$VENV_DIR" --clear
echo "*\n.*" >> "$VENV_DIR/.gitignore"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

create_venv appends *\n.* via echo, which is not portable (echo may not interpret \n) and will duplicate entries on repeated runs. Prefer using printf (or a heredoc) and write the .gitignore content idempotently (overwrite or check before appending).

Suggested change
echo "*\n.*" >> "$VENV_DIR/.gitignore"
printf '%s\n' '*' '.*' > "$VENV_DIR/.gitignore"

Copilot uses AI. Check for mistakes.
# Check that Python version supports venv
if ! python -c 'import venv' 1> /dev/null 2> /dev/null; then
echo "WARNING: Python version must be > 3.3 to create a virtual environment."
touch "$STATE_FILE"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

On Python versions without venv, this script touches the state file and then exits with failure. That means the next run will see the state file and silently exit 0, masking the persistent error. Avoid writing the “completed” marker on failure paths (or encode failure state separately).

Suggested change
touch "$STATE_FILE"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants