-
-
Notifications
You must be signed in to change notification settings - Fork 28
Ported recent shell script changes to PHP tooling package. #2472
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -20,6 +20,25 @@ namespace DrevOps\VortexTooling; | |
| require_once __DIR__ . '/helpers.php'; | ||
| execute_override(basename(__FILE__)); | ||
|
|
||
| // ----------------------------------------------------------------------------- | ||
| // Branch filter gate. | ||
| // | ||
| // Comma-separated list of branch names. When set, GitHub notifications are | ||
| // only sent for deployments on the listed branches. When empty, no filtering | ||
| // is applied. Checked before required variable validation so channels not | ||
| // configured for the current branch can short-circuit cleanly. | ||
| // ----------------------------------------------------------------------------- | ||
|
|
||
| $notify_github_branches = getenv_default('VORTEX_NOTIFY_GITHUB_BRANCHES', ''); | ||
| if ($notify_github_branches !== '') { | ||
| $current_branch = (string) (getenv('VORTEX_NOTIFY_BRANCH') ?: ''); | ||
| $branch_list = array_map('trim', explode(',', $notify_github_branches)); | ||
| if (!in_array($current_branch, $branch_list, TRUE)) { | ||
| pass(sprintf('Skipping GitHub notification for branch \'%s\'.', $current_branch)); | ||
| quit(); | ||
| } | ||
|
Comment on lines
+32
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the same branch source as the GitHub notifier config. The gate ignores Proposed fix-$notify_github_branches = getenv_default('VORTEX_NOTIFY_GITHUB_BRANCHES', '');
+$notify_github_branches = getenv_default('VORTEX_NOTIFY_GITHUB_BRANCHES', '');
if ($notify_github_branches !== '') {
- $current_branch = (string) (getenv('VORTEX_NOTIFY_BRANCH') ?: '');
- $branch_list = array_map('trim', explode(',', $notify_github_branches));
+ $current_branch = (string) getenv_default('VORTEX_NOTIFY_GITHUB_BRANCH', 'VORTEX_NOTIFY_BRANCH', '');
+ $branch_list = array_values(array_filter(
+ array_map('trim', explode(',', $notify_github_branches)),
+ static fn(string $branch): bool => $branch !== ''
+ ));
if (!in_array($current_branch, $branch_list, TRUE)) {
pass(sprintf('Skipping GitHub notification for branch \'%s\'.', $current_branch));
quit();
}
}🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not adopting. This PR is a direct port of the upstream shell There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(ᓀ ᓀ) ✏️ Learnings added
🧠 Learnings used |
||
| } | ||
|
|
||
| // ----------------------------------------------------------------------------- | ||
|
|
||
| // GitHub notification personal access token. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,25 @@ namespace DrevOps\VortexTooling; | |
| require_once __DIR__ . '/helpers.php'; | ||
| execute_override(basename(__FILE__)); | ||
|
|
||
| // ----------------------------------------------------------------------------- | ||
| // Branch filter gate. | ||
| // | ||
| // Comma-separated list of branch names. When set, JIRA notifications are | ||
| // only sent for deployments on the listed branches. When empty, no filtering | ||
| // is applied. Checked before required variable validation so channels not | ||
| // configured for the current branch can short-circuit cleanly. | ||
| // ----------------------------------------------------------------------------- | ||
|
|
||
| $notify_jira_branches = getenv_default('VORTEX_NOTIFY_JIRA_BRANCHES', ''); | ||
| if ($notify_jira_branches !== '') { | ||
| $current_branch = (string) (getenv('VORTEX_NOTIFY_BRANCH') ?: ''); | ||
| $branch_list = array_map('trim', explode(',', $notify_jira_branches)); | ||
| if (!in_array($current_branch, $branch_list, TRUE)) { | ||
| pass(sprintf('Skipping JIRA notification for branch \'%s\'.', $current_branch)); | ||
| quit(); | ||
| } | ||
|
Comment on lines
+32
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Branch gate should honor Current gating can skip valid JIRA notifications if only the channel-specific branch variable is configured. Proposed fix $notify_jira_branches = getenv_default('VORTEX_NOTIFY_JIRA_BRANCHES', '');
if ($notify_jira_branches !== '') {
- $current_branch = (string) (getenv('VORTEX_NOTIFY_BRANCH') ?: '');
- $branch_list = array_map('trim', explode(',', $notify_jira_branches));
+ $current_branch = (string) getenv_default('VORTEX_NOTIFY_JIRA_BRANCH', 'VORTEX_NOTIFY_BRANCH', '');
+ $branch_list = array_values(array_filter(
+ array_map('trim', explode(',', $notify_jira_branches)),
+ static fn(string $branch): bool => $branch !== ''
+ ));
if (!in_array($current_branch, $branch_list, TRUE)) {
pass(sprintf('Skipping JIRA notification for branch \'%s\'.', $current_branch));
quit();
}
}🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not adopting, same reasoning as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(´(エ)`) ノ ✏️ Learnings added
|
||
| } | ||
|
|
||
| // ----------------------------------------------------------------------------- | ||
|
|
||
| // JIRA notification project name. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.