1. Go to this page and download the library: Download conduit-ui/pr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
conduit-ui / pr example snippets
use ConduitUI\Pr\PullRequest;
// Approve and merge a PR
PullRequest::find('owner/repo', 123)
->approve('LGTM! Shipping it.')
->merge();
// Auto-merge all passing Dependabot PRs
PullRequest::query('owner/repo')
->author('dependabot[bot]')
->open()
->get()
->filter(fn($pr) => $pr->checksPass())
->each(fn($pr) => $pr->merge());
// All open PRs
PullRequest::query('owner/repo')->open()->get();
// All closed PRs
PullRequest::query('owner/repo')->closed()->get();
// All merged PRs
PullRequest::query('owner/repo')->merged()->get();
// Run this on a schedule (every 15 minutes)
PullRequest::query('owner/repo')
->author('dependabot[bot]')
->open()
->get()
->filter(fn($pr) => $pr->checksPass())
->filter(fn($pr) => $pr->title->contains(['patch', 'minor']))
->each(function($pr) {
$pr->approve('Auto-approving passing dependency update');
$pr->merge(strategy: 'squash');
});
// Block merge if not approved by 2+ reviewers
$pr = PullRequest::find('owner/repo', 123);
if ($pr->approvals()->count() < 2) {
$pr->comment('⚠️ This PR
// Add "shipped" label to all merged PRs from this week
PullRequest::query('owner/repo')
->merged()
->since(now()->startOfWeek())
->get()
->each(fn($pr) => $pr->addLabels(['shipped']));
// Auto-merge hotfixes that pass CI
PullRequest::query('owner/repo')
->label('hotfix')
->open()
->get()
->filter(fn($pr) => $pr->checksPass())
->each(function($pr) {
$pr->approve('Hotfix approved via automation');
$pr->merge(strategy: 'squash');
});
use ConduitUI\Pr\PullRequest;
$pr = PullRequest::find('owner/repo', 123);
$prs = PullRequest::query('owner/repo')->open()->get();
use ConduitUI\Pr\PullRequestManager;
$manager = new PullRequestManager('owner/repo');
$pr = $manager->find(123);
$prs = $manager->query()->open()->get();
$pr->id; // int
$pr->number; // int
$pr->title; // string
$pr->state; // 'open' | 'closed' | 'merged'
$pr->author; // User object
$pr->reviewers; // Collection of User objects
$pr->labels; // Collection of Label objects
$pr->headBranch; // string
$pr->baseBranch; // string
$pr->mergeable; // bool
$pr->createdAt; // Carbon instance
$pr->updatedAt; // Carbon instance
$pr->mergedAt; // ?Carbon instance
$pr->checksPass(); // bool - All CI checks passing
$pr->approved(); // bool - Has approvals
$pr->approvals(); // Collection of Review objects
bash
php artisan vendor:publish --tag="pr-config"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.