Skip to content

Commit 1910d72

Browse files
[TASK] Add GIT URI to Slack webhook (#313)
Currently only a composer key is emitted in the slack hook. However, a URI to the actua GIT repository would be helpful, because: 1.) A composer package may not have been released (yet) of an extension 2.) A TER package may not have been released (yet) of an extension 3.) The composer key and the Github Repo vendor/name may differ This commit is unverified. I am crossing my fingers that `$jar->getRepositoryUrl()` really holds what I expect it to. :-D
1 parent 64ab28a commit 1910d72

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/Service/SlackService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function sendRepositoryDiscoveryMessage(DocumentationJar $jar): ResponseI
4444
$docsLink = $this->docsService->generateLinkToDocs($jar);
4545
$deploymentsUrl = $this->router->generate('admin_docs_deployments', [], RouterInterface::ABSOLUTE_URL);
4646
$webhookDocsUrl = $this->docsService->getDocsServer() . '/permalink/h2document:webhook';
47+
$gitUrl = $jar->getRepositoryUrl();
4748

4849
$message = [
4950
'channel' => '#typo3-documentation',
@@ -59,7 +60,7 @@ public function sendRepositoryDiscoveryMessage(DocumentationJar $jar): ResponseI
5960
. "\u{2022} A documentation maintainer will review and approve the repository\n"
6061
. "\u{2022} Once approved, docs will be rendered and deployed to <{$docsLink}|docs.typo3.org>\n"
6162
. "\u{2022} This is handled by volunteers \u{2014} please be patient\n\n"
62-
. ":hammer_and_wrench: *Maintainers:* <{$deploymentsUrl}|Review pending deployments>\n"
63+
. ":hammer_and_wrench: *Maintainers:* <{$deploymentsUrl}|Review pending deployments> | <{$gitUrl}|:git:>\n"
6364
. ":information_source: *Extension authors:* <{$webhookDocsUrl}|How does this work?>",
6465
'fallback' => "Repository {$repoKey} is awaiting documentation approval at {$deploymentsUrl}",
6566
'footer' => sprintf("TYPO3 Intercept \u{00b7} <{%s}|(?)>", self::SOURCE_URL),

tests/Functional/Service/SlackServiceTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function testSendRepositoryDiscoveryMessageContainsExpectedPayload(): voi
4444
$jar->setVendor('acme');
4545
$jar->setName('my-extension');
4646
$jar->setPackageName('acme/my-extension');
47+
$jar->setRepositoryUrl('https://github.com/acme/my-extension.git');
4748
$jar->setTypeShort('p');
4849
$jar->setTargetBranchDirectory('main');
4950

@@ -90,5 +91,7 @@ public function testSendRepositoryDiscoveryMessageContainsExpectedPayload(): voi
9091

9192
// Must opt into mrkdwn rendering for the text field
9293
self::assertContains('text', $attachment['mrkdwn_in']);
94+
95+
self::assertStringContainsString('<https://github.com/acme/my-extension.git|:git:', $attachment['text']);
9396
}
9497
}

0 commit comments

Comments
 (0)