Created
March 28, 2023 12:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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