Skip to content

Commit

Permalink
more updates (#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm1957 authored Dec 25, 2023
1 parent df97555 commit 9163141
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
8 changes: 4 additions & 4 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ function getLabels(prID) {
.then(response => response.data )
}

function createLabel(label, name, description, color) {
function createLabel(name, description, color) {
return axios.post(`https://api.github.com/repos/ioBroker/ioBroker.repositories/labels`,
{
"name": name,
"description": description,
"color": color
'name': `${name}`,
'description': `${description}`,
'color': `${color}`
},
{
headers: {
Expand Down
31 changes: 17 additions & 14 deletions lib/stableBrandNewReminder.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';
const {
addLabel,
createLabel,
getLabels,
getAllComments,
getGithub,
getLabels,
} = require('./common');

async function doIt() {
Expand All @@ -27,12 +28,13 @@ async function doIt() {
if ( nowTs < targetTs ) {
console.log(` will merged after ${dateStr}`);
const label = `* ${dateStr} *`;
const labels = getLabels('');
if ( ! labels.filter( (f) => { return f.name===`${label}`})) {
console.log(` will create label $label}`);
addLabel(`${label}, ``remind after ${dateStr}`, `#ffffff`);
}
addLabels(`${issue.number}`, `${label}`);
const labels = await getLabels('');
//if ( ! labels.filter( (f) => { console.log( f.name ); return f.name===`${label}`})) {
if ( ! labels.includes(`${label}`)) {
console.log(` will create label $label}`);
await createLabel(`${label}`, `remind after ${dateStr}`, `#ffffff`);
}
await addLabel(`${issue.number}`, `${label}`);
} else {
console.log(` should be merged now (deadline ${dateStr})`);
await addLabel(issue.number, ['⚠️check']);
Expand All @@ -51,12 +53,13 @@ async function doIt() {
if ( nowTs < targetTs ) {
console.log(` will remind at ${dateStr}`);
const label = `* ${dateStr} *`;
const labels = getLabels('');
if ( ! labels.filter( (f) => { return f.name===`${label}`})) {
console.log(` will create label $label}`);
addLabel(`${label}, ``reminde after ${dateStr}`, `#ffffff`);
const labels = await getLabels('');
//if ( ! labels.filter( (f) => { console.log( f.name ); return f.name===`${label}`})) {
if ( ! labels.includes(`${label}`)) {
console.log(` will create label ${label}`);
await createLabel(`${label}`, `remind after ${dateStr}`, `#ffffff`);
}
addLabels(`${issue.number}`, `${label}`);
await addLabel(`${issue.number}`, `${label}`);
} else {
console.log(` should be checked now (deadline ${dateStr})`);
await addLabel(issue.number, ['⚠️check']);
Expand All @@ -76,12 +79,12 @@ async function doIt() {

// activate for debugging purposes
// process.env.GITHUB_REF = 'refs/pull/2348/merge';
// process.env.OWN_GITHUB_TOKEN = 'insert token';
// process.env.OWN_GITHUB_TOKEN = 'insert here';
// process.env.GITHUB_EVENT_PATH = __dirname + '/../event.json';

//console.log(`process.env.GITHUB_REF = ${process.env.GITHUB_REF}`);
//console.log(`process.env.GITHUB_EVENT_PATH = ${process.env.GITHUB_EVENT_PATH}`);
//console.log(`process.env.OWN_GITHUB_TOKEN = ${(process.env.OWN_GITHUB_TOKEN || '').length}`);
console.log(`process.env.OWN_GITHUB_TOKEN = ${(process.env.OWN_GITHUB_TOKEN || '').length}`);

doIt()
.then(result => console.log(result))
Expand Down

0 comments on commit 9163141

Please sign in to comment.