Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vortex/docs/content/deployment/notifications.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Post deployment status to GitHub pull requests.
|----------|----------|---------|----------|-------------|
| `VORTEX_NOTIFY_GITHUB_TOKEN` | **Yes** | | Hosting | GitHub personal access token |
| `VORTEX_NOTIFY_GITHUB_REPOSITORY` | **Yes** | | Hosting | Repository in `owner/repo` format |
| `VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | No | `PR` | `.env` | Environment type |
| `VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | No | `${VORTEX_NOTIFY_LABEL}` | `.env` | Environment name (defaults to label, e.g. `PR-123`) |

### Example

Expand Down
2 changes: 1 addition & 1 deletion .vortex/docs/content/development/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale
| <a id="vortex_notify_environment_url"></a>`VORTEX_NOTIFY_ENVIRONMENT_URL` | Notification environment URL (where the site was deployed). | `UNDEFINED` | `scripts/vortex/notify.sh` |
| <a id="vortex_notify_event"></a>`VORTEX_NOTIFY_EVENT` | Notification event type.<br/><br/>Can be 'pre_deployment' or 'post_deployment'. | `post_deployment` | `scripts/vortex/notify.sh` |
| <a id="vortex_notify_github_branch"></a>`VORTEX_NOTIFY_GITHUB_BRANCH` | GitHub notification git branch name. This will be used as the 'ref' parameter in GitHub's Deployment API. | `${VORTEX_NOTIFY_BRANCH}` | `scripts/vortex/notify-github.sh` |
| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | GitHub notification environment type: production, uat, dev, pr. Used as the 'environment' parameter in GitHub's Deployment API. | `PR` | `scripts/vortex/notify-github.sh` |
| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | GitHub notification environment type. Used as the 'environment' parameter in GitHub's Deployment API. Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-`123`" or branch name) for unique per-PR/branch environments. This prevents cross-PR deployment interference where deploying one PR would mark another PR's deployment as inactive. | `PR` | `scripts/vortex/notify-github.sh` |
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align the “Default value” column with the new default behavior.

The description now says the default derives from VORTEX_NOTIFY_LABEL with a PR fallback, but the default value column still lists PR only. This is internally inconsistent and can mislead users.

📝 Suggested doc fix
-| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE`                                       | GitHub notification environment type. Used as the 'environment' parameter in GitHub's Deployment API. Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-`123`" or branch name) for unique per-PR/branch environments. This prevents cross-PR deployment interference where deploying one PR would mark another PR's deployment as inactive.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `PR`                                                                     | `scripts/vortex/notify-github.sh`                                                                                                                                                                                                                                                 |
+| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE`                                       | GitHub notification environment type. Used as the 'environment' parameter in GitHub's Deployment API. Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-`123`" or branch name) for unique per-PR/branch environments. This prevents cross-PR deployment interference where deploying one PR would mark another PR's deployment as inactive.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `${VORTEX_NOTIFY_LABEL}` (fallback `PR`)                                 | `scripts/vortex/notify-github.sh`                                                                                                                                                                                                                                                 |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | GitHub notification environment type. Used as the 'environment' parameter in GitHub's Deployment API. Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-`123`" or branch name) for unique per-PR/branch environments. This prevents cross-PR deployment interference where deploying one PR would mark another PR's deployment as inactive. | `PR` | `scripts/vortex/notify-github.sh` |
| <a id="vortex_notify_github_environment_type"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` | GitHub notification environment type. Used as the 'environment' parameter in GitHub's Deployment API. Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-`123`" or branch name) for unique per-PR/branch environments. This prevents cross-PR deployment interference where deploying one PR would mark another PR's deployment as inactive. | `${VORTEX_NOTIFY_LABEL}` (fallback `PR`) | `scripts/vortex/notify-github.sh` |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vortex/docs/content/development/variables.mdx at line 327, Update the
"Default value" column for VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE to reflect the
new behavior: show that it defaults to VORTEX_NOTIFY_LABEL with a fallback of
"PR" (e.g., "VORTEX_NOTIFY_LABEL (fallback: PR)") instead of just "PR"; update
the table cell text and any inline example references to match the description
that the environment resolves from VORTEX_NOTIFY_LABEL or falls back to PR, and
ensure consistency with the referenced script name notify-github.sh and the
variable VORTEX_NOTIFY_LABEL used in the description.

| <a id="vortex_notify_github_environment_url"></a>`VORTEX_NOTIFY_GITHUB_ENVIRONMENT_URL` | GitHub notification deployment environment URL. | `${VORTEX_NOTIFY_ENVIRONMENT_URL}` | `scripts/vortex/notify-github.sh` |
| <a id="vortex_notify_github_event"></a>`VORTEX_NOTIFY_GITHUB_EVENT` | GitHub notification event type. Can be 'pre_deployment' or 'post_deployment'. | `${VORTEX_NOTIFY_EVENT}` | `scripts/vortex/notify-github.sh` |
| <a id="vortex_notify_github_repository"></a>`VORTEX_NOTIFY_GITHUB_REPOSITORY` | GitHub notification repository in owner/repo format. | `UNDEFINED` | `scripts/vortex/notify-github.sh` |
Expand Down
8 changes: 4 additions & 4 deletions .vortex/tests/bats/unit/notify-github.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ load ../_helper.bash
declare -a STEPS=(
"Started dispatching notifications."
"Started GitHub notification for pre_deployment event."
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"existingbranch\", \"environment\": \"PR\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"existingbranch\", \"environment\": \"existingbranch\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"Marked deployment as started."
"Finished GitHub notification for pre_deployment event."
"Finished dispatching notifications."
Expand Down Expand Up @@ -46,7 +46,7 @@ load ../_helper.bash
declare -a STEPS=(
"Started dispatching notifications."
"Started GitHub notification for pre_deployment event."
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"feature/my-pr-branch\", \"environment\": \"PR\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"feature/my-pr-branch\", \"environment\": \"PR-123\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"Marked deployment as started."
"Finished GitHub notification for pre_deployment event."
"Finished dispatching notifications."
Expand Down Expand Up @@ -79,7 +79,7 @@ load ../_helper.bash
declare -a STEPS=(
"Started dispatching notifications."
"Started GitHub notification for pre_deployment event."
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"existingbranch\", \"environment\": \"PR\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {\"ref\":\"existingbranch\", \"environment\": \"existingbranch\", \"auto_merge\": false, \"required_contexts\": []} # {\"id\": \"${app_id}\", \"othervar\": \"54321\"}"
"Marked deployment as started."
"Finished GitHub notification for pre_deployment event."
"Finished dispatching notifications."
Expand Down Expand Up @@ -109,7 +109,7 @@ load ../_helper.bash
declare -a STEPS=(
"Started dispatching notifications."
"Started GitHub notification for pre_deployment event."
'@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {"ref":"nonexistingbranch", "environment": "PR", "auto_merge": false, "required_contexts": []} # {"message": "No ref found for: nonexistingbranch","documentation_url": "https://docs.github.com/rest/deployments/deployments#create-a-deployment","status": "422"}'
'@curl -X POST -H Authorization: token token12345 -H Accept: application/vnd.github.v3+json -s https://api.github.com/repos/myorg/myrepo/deployments -d {"ref":"nonexistingbranch", "environment": "nonexistingbranch", "auto_merge": false, "required_contexts": []} # {"message": "No ref found for: nonexistingbranch","documentation_url": "https://docs.github.com/rest/deployments/deployments#create-a-deployment","status": "422"}'
"Failed to get a deployment ID for a pre_deployment operation. Payload:"
"Wait for GitHub checks to finish and try again."
"-Marked deployment as finished."
Expand Down
4 changes: 2 additions & 2 deletions .vortex/tests/manual/try-github-notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export VORTEX_NOTIFY_CHANNELS=github
export VORTEX_NOTIFY_GITHUB_TOKEN="${GITHUB_TOKEN}"
export VORTEX_NOTIFY_GITHUB_REPOSITORY="${GITHUB_REPOSITORY}"

# Optional: Customize environment type
export VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE="${VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE:-PR}"
# Optional: Customize environment type (defaults to VORTEX_NOTIFY_LABEL, i.e. "PR-2")
# export VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE="custom-env-name"

echo "Running notification script..."
echo ""
Expand Down
7 changes: 5 additions & 2 deletions scripts/vortex/notify-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ VORTEX_NOTIFY_GITHUB_EVENT="${VORTEX_NOTIFY_GITHUB_EVENT:-${VORTEX_NOTIFY_EVENT:
# GitHub notification deployment environment URL.
VORTEX_NOTIFY_GITHUB_ENVIRONMENT_URL="${VORTEX_NOTIFY_GITHUB_ENVIRONMENT_URL:-${VORTEX_NOTIFY_ENVIRONMENT_URL:-}}"

# GitHub notification environment type: production, uat, dev, pr.
# GitHub notification environment type.
# Used as the 'environment' parameter in GitHub's Deployment API.
VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE="${VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE:-PR}"
# Defaults to VORTEX_NOTIFY_LABEL (e.g. "PR-123" or branch name) for unique
# per-PR/branch environments. This prevents cross-PR deployment interference
# where deploying one PR would mark another PR's deployment as inactive.
VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE="${VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE:-${VORTEX_NOTIFY_LABEL:-PR}}"

# ------------------------------------------------------------------------------

Expand Down