Create Github Issues

Create Github Issues

by Lissandro Dittmar

HTML

<div id="banner-message">
  <p>Create issue from file</p>
  <button>Start creation</button>
</div>
<div style="background-color: white;">
  <ol id="listeSuccess">
  
  </ol>
  <ol id="liste">
  
  </ol>
  <span id="result"></span>
</div>

CSS

i {
  color: #669FAB;
}

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#banner-message {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  font-size: 25px;
  text-align: center;
  transition: all 0.2s;
  margin: 0 auto;
  width: 300px;
}

button {
  background: #0084ff;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 15px;
  color: #fff;
}

#banner-message.alt {
  background: #0084ff;
  color: #fff;
  margin-top: 40px;
  width: 200px;
}

#banner-message.alt button {
  background: #fff;
  color: #000;
}

JavaScript

const githubToken = ""; //https://github.com/settings/tokens
const test = false;

const filename = "createIssue1";

let issueTitle = "Please add you adapter to our repository";

const issueBody = "We saw your adapter and if it is ready please request that it is added to the repository. With this it becomes available for all users. Please consult https://github.com/ioBroker/ioBroker.repositories#add-a-new-adapter-to-the-latest-repository and the following sections for more details.\r\nIf you need help, contact us in the forum https://forum.iobroker.net/ or in the developer chat https://github.com/iobroker-community-adapters/info .\r\n\r\nThank you for your support.";

let issuesCreated = [];

let issuesList = [];

const start = async function () {
    adapterList = await getAdapterList();
    if (adapterList) {         
    		$('#listeSuccess').append("<li style='color: blue;'>Done last time: <span id='alreadydone'></span></li>");
        $('#listeSuccess').append("<li style='color: blue;'>Total Repos: <span id='totalrepos'></span></li>");
        $('#listeSuccess').append("<li style='color: blue;'>Done now: <span id='donenow'></span></li>");        
        await startFunc();    
        await delay(15000);
        $('#donenow').text(issuesCreated.length);
        console.log(JSON.stringify(issuesCreated));
    } else {
        $('#liste').append("<li style='color: red;'>ERROR - NO ADAPTER LIST</li>");
    }
};

async function asyncForEach(array, callback) {
    for (let index = 0; index < array.length; index++) {
        await callback(array [index], index, array);
    }
}

(function ($) {
    $.extend({
        // Case insensative $.inArray (http://api.jquery.com/jquery.inarray/)
        // $.inArrayIn(value, array [, fromIndex])
        //  value (type: String)
        //    The value to search for
        //  array (type: Array)
        //    An array through which to search.
        //  fromIndex (type: Number)
        //    The index of the array at which...