Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more updates #3119

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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