diff --git a/.vortex/docs/content/deployment/notifications.mdx b/.vortex/docs/content/deployment/notifications.mdx
index 9721d63b2..c20b70f4b 100644
--- a/.vortex/docs/content/deployment/notifications.mdx
+++ b/.vortex/docs/content/deployment/notifications.mdx
@@ -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
diff --git a/.vortex/docs/content/development/variables.mdx b/.vortex/docs/content/development/variables.mdx
index cd1f9865a..352aa8a8d 100644
--- a/.vortex/docs/content/development/variables.mdx
+++ b/.vortex/docs/content/development/variables.mdx
@@ -324,7 +324,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale
| `VORTEX_NOTIFY_ENVIRONMENT_URL` | Notification environment URL (where the site was deployed). | `UNDEFINED` | `scripts/vortex/notify.sh` |
| `VORTEX_NOTIFY_EVENT` | Notification event type.
Can be 'pre_deployment' or 'post_deployment'. | `post_deployment` | `scripts/vortex/notify.sh` |
| `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` |
-| `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` |
+| `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` |
| `VORTEX_NOTIFY_GITHUB_ENVIRONMENT_URL` | GitHub notification deployment environment URL. | `${VORTEX_NOTIFY_ENVIRONMENT_URL}` | `scripts/vortex/notify-github.sh` |
| `VORTEX_NOTIFY_GITHUB_EVENT` | GitHub notification event type. Can be 'pre_deployment' or 'post_deployment'. | `${VORTEX_NOTIFY_EVENT}` | `scripts/vortex/notify-github.sh` |
| `VORTEX_NOTIFY_GITHUB_REPOSITORY` | GitHub notification repository in owner/repo format. | `UNDEFINED` | `scripts/vortex/notify-github.sh` |
diff --git a/.vortex/tests/bats/unit/notify-github.bats b/.vortex/tests/bats/unit/notify-github.bats
index b383f129e..bad58acd2 100644
--- a/.vortex/tests/bats/unit/notify-github.bats
+++ b/.vortex/tests/bats/unit/notify-github.bats
@@ -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."
@@ -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."
@@ -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."
@@ -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."
diff --git a/.vortex/tests/manual/try-github-notification.sh b/.vortex/tests/manual/try-github-notification.sh
index 6e7c40a29..846ff3a32 100755
--- a/.vortex/tests/manual/try-github-notification.sh
+++ b/.vortex/tests/manual/try-github-notification.sh
@@ -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 ""
diff --git a/scripts/vortex/notify-github.sh b/scripts/vortex/notify-github.sh
index b179d6db6..1c20192fe 100755
--- a/scripts/vortex/notify-github.sh
+++ b/scripts/vortex/notify-github.sh
@@ -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}}"
# ------------------------------------------------------------------------------