Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Created March 28, 2023 12:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/008058ed8ff047a460c4f4af86f0cf64 to your computer and use it in GitHub Desktop.
Save peterjaap/008058ed8ff047a460c4f4af86f0cf64 to your computer and use it in GitHub Desktop.
Deployer task n8n webhook to update PHP packages Airtable. Set the webhook URL to the env var N8N_WEBHOOK_PACKAGES
<?php
desc('Send the composer.lock file to our n8n endpoint to save package information in our overview');
task('update-packages-overview', function () {
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => getenv('N8N_WEBHOOK_PACKAGES'),
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => file_get_contents('composer.lock'),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'project: ' . getenv('CI_PROJECT_PATH')
],
]);
curl_exec($curl);
curl_close($curl);
})->select('stage=production');
if (getenv('N8N_WEBHOOK_PACKAGES')) {
after('deploy:success', 'update-packages-overview');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment