Skip to content
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

Fallback project parameters #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Option | Type | Default | Description
`basic_auth` | bool | `false` | Whether to show project environment's HTTP Authentication username and password in Slack message. WARNING: If true, potentially sensitive data passwords will be sent in the clear to your Slack channel.
`configurations` | bool | `false` | Whether to show project's configurations on every slack message. If false, it will be shown only for master when you push, merge or have a subscription plan update.
`attachment_color` | string | `'#e8e8e8'` | RGB color for Slack attachment.
`project` | string | `null` | If present, it will be used as the project name instead of the default string. Project name is misisng in Platform.sh's payload.
`project_url` | string | `null` | If present, the project name will be used as a link to this URL on Slack notifications. Environment branch will be appended automatically to the URL.
`project` | string | `null` | If present, it will be used as the project title instead of the default.
`project_url` | string | `null` | If present, the project title will link to this URL instead of the default for Slack notifications. Environment branch will be appended automatically to the URL. If empty, the default project link will be used: `https://console.platform.sh/project/{project_id}`.
`debug` | string | `null` | An optional path where posssible unhandled webhooks JSON can be saved. This is useful if you want to send over the json for me to add support for it.
`debug_all` | boolean | `false` | If `debug` is set, it saves the JSON of every webhook sent, not only the unhandled ones.
`active` | boolean | `false` | If `active` is set, only webhooks of active environments will be sent to platform. Useful for some external integrations.
Expand Down
7 changes: 7 additions & 0 deletions src/Platformsh2Slack.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ function processPlatformshPayload() {
// Project string identifier
//
$project_string = 'Platform.sh';
if (!empty($platformsh->payload->project->title)) {
$project_string = $platformsh->payload->project->title;
}
if ($this->config['project']) {
$project_string = $this->config['project'];
}
Expand All @@ -142,6 +145,10 @@ function processPlatformshPayload() {
$url .= "/$branch";
$project_string = "<$url|$project_string>";
}
else {
$url = "https://console.platform.sh/project/$project_id/$branch";
$project_string = "<$url|$project_string>";
}

// Commits
if (!empty($platformsh->payload->commits_count)) {
Expand Down