This commit is contained in:
James 2019-08-01 15:50:41 +01:00
parent c468275075
commit ba76fded92
2 changed files with 49 additions and 0 deletions

1
import.csv Normal file
View File

@ -0,0 +1 @@
"example title","example body","test"
1 example title example body test

48
import.php Normal file
View File

@ -0,0 +1,48 @@
<?php
require('bootstrap.php');
$config=require("config.php");
//pass cmd line args
if($argc<3){
die(basename(__FILE__)." <USER> <REPO> [debug]\n");
}
$debug = ($argc==4 && $argv[3]=='debug');
//open connection and repo
$client=new Client($config['url'],$config['user'],$config['pass'],$debug);
$repo=$client->getRepo($argv[1],$argv[2]);
function label($name){
if($label=$repo->getLabelByName($name)){
return $label;
}else{
return $repo->createLabel($name);
}
}
function issue($name){
if($label=$repo->getIssueByName($name)){
return $issue;
}else{
return $repo->createIssue($name);
}
}
/*
$jan=label('janurary/repeat');
$iss=issue('test');
$iss->addLabel($jan);
*/
/*
//do the import
$f=fopen('import.csv','r');
while($data=fgetcsv($f)){
print_r($data);
}
*/
$issue=new Issue($repo);
$issue->setTitle('nice')->setBody('ly')->save();
print_r($issue);