User plugin issue labeling (#1397)

* Add automatic issue labeling

* branch issue fix

* try debug

* maybe

* fix indents

* f it I use js

* disable for testing

* changed id

* added git

* Update issue template with plugin dropdown options

* Only push on change

* Add multiple

* save keys file and additional safety

* Update issue template with plugin dropdown options

* delete updated_issue.yml

* Add Language in front of plugin name

* Update issue template with plugin dropdown options

* Add Labels

* debug auto labeling

* new extraction method

* SELECTED_PLUGINS not available

* Maybe

* maybe this

* Now

* please

* Now really

* maybe

* debug

* debug

* remove linebreak

* delete "

* delete " differently

* corrected split

* fix multiline issue

* maybe this way

* Added Severity

* Update issue template with plugin dropdown options

* ignore if not plugin issue

* add string infront of labels

* Update issue template with plugin dropdown options

* Test job skip

* Test job skip 2

* Test job skip 2.1

* reactivated checks

* Added [skip ci] to commit message

* change label format

* pr test

* test change

* deactivate skip

* activate skip

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Patrick Loser
2025-02-01 03:02:01 +01:00
committed by GitHub
parent 00b4c21779
commit 0e37fbc567
6 changed files with 482 additions and 8 deletions
+40
View File
@@ -0,0 +1,40 @@
const version = require('../../package.json').version;
const dist = `plugins/v${version}`;
const fs = require('fs');
const rawText = fs.readFileSync(
'.github/scripts/blank_report_issue.yml',
'utf8',
);
async function main() {
const pluginsRaw = await fetch(
`https://raw.githubusercontent.com/LNReader/lnreader-plugins/${dist}/.dist/plugins.min.json`,
).then(res => res.json());
const plugins = pluginsRaw.reduce((arr, plugin) => {
arr[plugin.lang + ': ' + plugin.name] = plugin.id;
return arr;
}, {});
let newKeys = Object.keys(plugins);
let savedKeys = [];
try {
let keys = JSON.parse(fs.readFileSync('.github/scripts/keys.json', 'utf8'));
savedKeys = Object.keys(keys);
} catch (err) {
console.log(err);
}
if (!sameKeys(newKeys, savedKeys) && Array.isArray(newKeys)) {
const text = newKeys.join('"\n - "');
fs.writeFileSync(
'.github/ISSUE_TEMPLATE/report_issue.yml',
rawText.replace(/{#CHANGE#}/g, '- "' + text + '"'),
);
fs.writeFileSync('.github/scripts/keys.json', JSON.stringify(plugins));
}
function sameKeys(a, b) {
return a.length === b.length && a.every(value => b.includes(value));
}
}
main();