-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Deepak/trigger events #207
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
ba38924
ecbbcab
6a97ee2
60bd17b
33a923c
a9c2cca
7e85f98
b662930
b3f3ca4
d5890cc
86b4fb1
2813cd1
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 @@ | ||
| /home/deepak/Projects/devops-directive-github-actions-course/.devbox/virtenv/poetry/bin/initHook.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /home/deepak/Projects/devops-directive-github-actions-course/.devbox/virtenv/python312/bin/venvShellHook.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/sh | ||
|
|
||
| poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -eu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| STATE_FILE="$DEVBOX_PROJECT_ROOT/.devbox/venv_check_completed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is_valid_venv() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ -f "$1/bin/activate" ] && [ -f "$1/bin/python" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is_devbox_venv() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ "$1/bin/python" -ef "$DEVBOX_PACKAGES_DIR/bin/python" ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| create_venv() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| python -m venv "$VENV_DIR" --clear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "*\n.*" >> "$VENV_DIR/.gitignore" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "*\n.*" >> "$VENV_DIR/.gitignore" | |
| printf '%s\n' '*' '.*' > "$VENV_DIR/.gitignore" |
Copilot
AI
Apr 16, 2026
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.
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).
| touch "$STATE_FILE" |
Copilot
AI
Apr 16, 2026
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.
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).
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,12 @@ jobs: | |
| say-hello-inline-bash: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - run: echo "Hello from an inline bash script in a GitHub Action Workflow!" | ||
| - run: echo "Hello from an inline bash script in a GitHub Action Workflow! By Deepak" | ||
|
|
||
| say-hello-inline-python: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - run: print("Hello from an inline python script in a GitHub Action Workflow!") | ||
| - run: print("Hello from an inline python script in a GitHub Action Workflow! By Deepak") | ||
| shell: python | ||
|
|
||
| say-hello-action: | ||
|
|
@@ -21,4 +21,4 @@ jobs: | |
| - uses: actions/hello-world-javascript-action@081a6d193d1dcb38460df1e6927486d748730f9d # v1.1 | ||
| # - 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" | ||
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,11 +5,14 @@ on: | |||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+9
|
||||||||||||||||||||||||||||||||||||||
| needs: | |
| - job-5 # a new job to explore the realtion and working of the jobs in a workflow |
Copilot
AI
Apr 16, 2026
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.
Spelling: “realtion” should be “relation”.
Copilot
AI
Apr 16, 2026
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.
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.
| # 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: |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,8 +23,8 @@ on: | |||||||||
| - "!03-core-features/filters/*.txt" | ||||||||||
|
|
||||||||||
| ### https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule | ||||||||||
| # schedule: | ||||||||||
| # - cron: "0 0 * * *" # Midnight UTC | ||||||||||
| schedule: | ||||||||||
| - cron: "0 0 * * *" # Midnight UTC | ||||||||||
|
||||||||||
| - cron: "0 0 * * *" # Midnight UTC | |
| - cron: "0 0 * * 0" # Midnight UTC every Sunday |
Copilot
AI
Apr 16, 2026
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.
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).
| - cron: "0 0 * * *" # Midnight UTC | |
| - cron: "0 0 * * *" # Midnight UTC |
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.
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.