chore: Lowercase GitHub Labels
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
name: Report Issue
|
name: Report Issue
|
||||||
description: Report a plugin issue in LNReader
|
description: Report a plugin issue in LNReader
|
||||||
labels: [Bug]
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: source
|
id: source
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Request Feature
|
name: Request Feature
|
||||||
description: Suggest an improvement for an existing plugin
|
description: Suggest an improvement for an existing plugin
|
||||||
labels: [Feature Request]
|
labels: [feature request]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: feature-description
|
id: feature-description
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Request Plugin
|
name: Request Plugin
|
||||||
description: Request a new plugin for LNReader
|
description: Request a new plugin for LNReader
|
||||||
labels: [Plugin Request]
|
labels: [plugin request]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
name: Report Issue
|
name: Report Issue
|
||||||
description: Report a plugin issue in LNReader
|
description: Report a plugin issue in LNReader
|
||||||
labels: [Bug]
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: source
|
id: source
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const rawText = fs.readFileSync(
|
|||||||
);
|
);
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
console.log(`Fetching plugins from: ${dist}`);
|
console.log(`Fetching published plugin manifest from ${dist}...`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
@@ -22,7 +22,7 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pluginsRaw = await response.json();
|
const pluginsRaw = await response.json();
|
||||||
console.log(`Found ${pluginsRaw.length} plugins`);
|
console.log(`Loaded ${pluginsRaw.length} plugins from the manifest.`);
|
||||||
|
|
||||||
const plugins = pluginsRaw.reduce((arr, plugin) => {
|
const plugins = pluginsRaw.reduce((arr, plugin) => {
|
||||||
arr[plugin.lang + ': ' + plugin.name] = plugin.id;
|
arr[plugin.lang + ': ' + plugin.name] = plugin.id;
|
||||||
@@ -36,24 +36,41 @@ async function main() {
|
|||||||
fs.readFileSync('.github/scripts/keys.json', 'utf8'),
|
fs.readFileSync('.github/scripts/keys.json', 'utf8'),
|
||||||
);
|
);
|
||||||
savedKeys = Object.keys(keys);
|
savedKeys = Object.keys(keys);
|
||||||
console.log(`Loaded ${savedKeys.length} existing plugin keys`);
|
console.log(`Loaded ${savedKeys.length} saved plugin keys.`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('No existing keys file found, creating new one');
|
console.log('No saved plugin keys found; a new key map will be created.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sameKeys(newKeys, savedKeys) && Array.isArray(newKeys)) {
|
|
||||||
console.log('Plugin list has changed, updating issue template...');
|
|
||||||
const text = newKeys.join('"\n - "');
|
const text = newKeys.join('"\n - "');
|
||||||
fs.writeFileSync(
|
const issueTemplate = rawText.replace(/{#CHANGE#}/g, '- "' + text + '"');
|
||||||
'.github/ISSUE_TEMPLATE/report_issue.yml',
|
|
||||||
rawText.replace(/{#CHANGE#}/g, '- "' + text + '"'),
|
const keysChanged = !sameKeys(newKeys, savedKeys) && Array.isArray(newKeys);
|
||||||
|
if (keysChanged) {
|
||||||
|
console.log(
|
||||||
|
`Plugin keys changed (${savedKeys.length} → ${newKeys.length}); writing keys.json.`,
|
||||||
);
|
);
|
||||||
fs.writeFileSync('.github/scripts/keys.json', JSON.stringify(plugins));
|
fs.writeFileSync('.github/scripts/keys.json', JSON.stringify(plugins));
|
||||||
console.log('Issue template updated successfully');
|
|
||||||
} else {
|
} else {
|
||||||
console.log('No changes detected in plugin list');
|
console.log('Plugin keys are up to date.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const templateChanged =
|
||||||
|
fs.readFileSync('.github/ISSUE_TEMPLATE/report_issue.yml', 'utf8') !==
|
||||||
|
issueTemplate;
|
||||||
|
if (templateChanged) {
|
||||||
|
fs.writeFileSync(
|
||||||
|
'.github/ISSUE_TEMPLATE/report_issue.yml',
|
||||||
|
issueTemplate,
|
||||||
|
);
|
||||||
|
console.log('Issue template changed; writing report_issue.yml.');
|
||||||
|
} else {
|
||||||
|
console.log('Issue template is up to date.');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
`Generation complete (${keysChanged || templateChanged ? 'changes written' : 'no changes'}).`,
|
||||||
|
);
|
||||||
|
|
||||||
function sameKeys(a, b) {
|
function sameKeys(a, b) {
|
||||||
return a.length === b.length && a.every(value => b.includes(value));
|
return a.length === b.length && a.every(value => b.includes(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
auto-label:
|
auto-label:
|
||||||
name: Auto Label Issues
|
name: Auto Label Issues
|
||||||
if: ${{ github.event.issue.body && contains(github.event.issue.body, '### Plugin') && contains(github.event.issue.labels.*.name, 'Bug') }}
|
if: ${{ github.event.issue.body && contains(github.event.issue.body, '### Plugin') && contains(github.event.issue.labels.*.name, 'bug') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -64,13 +64,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
LABELS="$(jq --arg keys "$SELECTED_PLUGIN" '. as $data | $keys | split(", ") as $keyList | $keyList[] | . as $key | if $data[$key] != null then "\($key)[\($data[$key])]" else empty end' ./.github/scripts/keys.json | sed 's/"//g' | sed 's/^[^:]*: //')"
|
LABELS="$(jq --arg keys "$SELECTED_PLUGIN" '. as $data | $keys | split(", ") as $keyList | $keyList[] | . as $key | if $data[$key] != null then "\($key)[\($data[$key])]" else empty end' ./.github/scripts/keys.json | sed 's/"//g' | sed 's/^[^:]*: //')"
|
||||||
|
|
||||||
# Add "Plugin: " in front of each label
|
LABELS="$(printf '%s' "$LABELS" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")"
|
||||||
LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/Plugin: /')"
|
|
||||||
|
# Add "plugin: " in front of each label
|
||||||
|
LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/plugin: /')"
|
||||||
|
|
||||||
FINAL_LABELS="$LABELS_WITH_PREFIX"
|
FINAL_LABELS="$LABELS_WITH_PREFIX"
|
||||||
|
|
||||||
if [ -n "$SELECTED_LANGUAGE" ]; then
|
if [ -n "$SELECTED_LANGUAGE" ]; then
|
||||||
FINAL_LABELS="${FINAL_LABELS}"$'\n'"Language: $SELECTED_LANGUAGE"
|
LOWERCASE_LANGUAGE="$(printf '%s' "$SELECTED_LANGUAGE" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")"
|
||||||
|
FINAL_LABELS="${FINAL_LABELS}"$'\n'"language: $LOWERCASE_LANGUAGE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save to GitHub environment
|
# Save to GitHub environment
|
||||||
@@ -84,9 +87,9 @@ jobs:
|
|||||||
REPOSITORY: ${{ github.repository }}
|
REPOSITORY: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg severity "$SELECTED_SEVERITY" \
|
--arg severity "$(printf '%s' "$SELECTED_SEVERITY" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")" \
|
||||||
--arg labels "$LABELS" \
|
--arg labels "$LABELS" \
|
||||||
'{labels: (["Severity: " + $severity] + ($labels | split("\n") | map(select(length > 0))))}' \
|
'{labels: (["severity: " + $severity] + ($labels | split("\n") | map(select(length > 0))))}' \
|
||||||
| gh api --method POST "repos/$REPOSITORY/issues/$ISSUE_NUMBER/labels" --input -
|
| gh api --method POST "repos/$REPOSITORY/issues/$ISSUE_NUMBER/labels" --input -
|
||||||
|
|
||||||
- name: Handle Missing Label
|
- name: Handle Missing Label
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ jobs:
|
|||||||
uses: tachiyomiorg/issue-moderator-action@v2
|
uses: tachiyomiorg/issue-moderator-action@v2
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
duplicate-label: Duplicate
|
duplicate-label: duplicate
|
||||||
|
|
||||||
duplicate-check-enabled: true
|
duplicate-check-enabled: true
|
||||||
duplicate-check-labels: |
|
duplicate-check-labels: |
|
||||||
["Plugin Request", "Domain Changed"]
|
["plugin request", "domain changed"]
|
||||||
|
|
||||||
existing-check-enabled: false
|
existing-check-enabled: false
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
auto-label:
|
auto-label:
|
||||||
name: Auto Label Theme
|
name: Auto Label Theme
|
||||||
if: contains(github.event.issue.labels.*.name, 'Plugin Request')
|
if: contains(github.event.issue.labels.*.name, 'plugin request')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
@@ -126,20 +126,20 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "## Theme Detection Result" >> $GITHUB_STEP_SUMMARY
|
echo "## Theme Detection Result" >> $GITHUB_STEP_SUMMARY
|
||||||
if [[ "$MADARA" == "true" ]]; then
|
if [[ "$MADARA" == "true" ]]; then
|
||||||
echo "🏷️ Adding label: Theme: Madara" >> $GITHUB_STEP_SUMMARY
|
echo "🏷️ Adding label: theme: madara" >> $GITHUB_STEP_SUMMARY
|
||||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Madara" -R $REPO
|
gh issue edit $ISSUE_NUMBER --add-label "theme: madara" -R $REPO
|
||||||
echo "theme=madara" >> "$GITHUB_OUTPUT"
|
echo "theme=madara" >> "$GITHUB_OUTPUT"
|
||||||
elif [[ "$LIGHNOVELWP" == "true" ]]; then
|
elif [[ "$LIGHNOVELWP" == "true" ]]; then
|
||||||
echo "🏷️ Adding label: Theme: Lighnovelwp" >> $GITHUB_STEP_SUMMARY
|
echo "🏷️ Adding label: theme: lighnovelwp" >> $GITHUB_STEP_SUMMARY
|
||||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Lighnovelwp" -R $REPO
|
gh issue edit $ISSUE_NUMBER --add-label "theme: lighnovelwp" -R $REPO
|
||||||
echo "theme=lightnovelwp" >> "$GITHUB_OUTPUT"
|
echo "theme=lightnovelwp" >> "$GITHUB_OUTPUT"
|
||||||
elif [[ "$HOTNOVELPUB" == "true" ]]; then
|
elif [[ "$HOTNOVELPUB" == "true" ]]; then
|
||||||
echo "🏷️ Adding label: Theme: Hotnovelpub" >> $GITHUB_STEP_SUMMARY
|
echo "🏷️ Adding label: theme: hotnovelpub" >> $GITHUB_STEP_SUMMARY
|
||||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Hotnovelpub" -R $REPO
|
gh issue edit $ISSUE_NUMBER --add-label "theme: hotnovelpub" -R $REPO
|
||||||
echo "theme=hotnovelpub" >> "$GITHUB_OUTPUT"
|
echo "theme=hotnovelpub" >> "$GITHUB_OUTPUT"
|
||||||
elif [[ "$FICTIONEER" == "true" ]]; then
|
elif [[ "$FICTIONEER" == "true" ]]; then
|
||||||
echo "🏷️ Adding label: Theme: Fictioneer" >> $GITHUB_STEP_SUMMARY
|
echo "🏷️ Adding label: theme: fictioneer" >> $GITHUB_STEP_SUMMARY
|
||||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Fictioneer" -R $REPO
|
gh issue edit $ISSUE_NUMBER --add-label "theme: fictioneer" -R $REPO
|
||||||
echo "theme=fictioneer" >> "$GITHUB_OUTPUT"
|
echo "theme=fictioneer" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "❌ No Theme Detected" >> $GITHUB_STEP_SUMMARY
|
echo "❌ No Theme Detected" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<img alt="Total number of available plugins" src="https://raw.githubusercontent.com/LNReader/lnreader-plugins/plugins/v3.0.0/total.svg">
|
<img alt="Total number of available plugins" src="https://raw.githubusercontent.com/LNReader/lnreader-plugins/plugins/v3.0.0/total.svg">
|
||||||
<img alt="Open plugin requests" src="https://img.shields.io/github/issues/lnreader/lnreader-plugins/Plugin%20Request?color=success&label=plugin%20requests">
|
<img alt="Open plugin requests" src="https://img.shields.io/github/issues/lnreader/lnreader-plugins/plugin%20request?color=success&label=plugin%20requests">
|
||||||
<img alt="Open bug reports" src="https://img.shields.io/github/issues/lnreader/lnreader-plugins/Bug?color=red&label=bugs">
|
<img alt="Open bug reports" src="https://img.shields.io/github/issues/lnreader/lnreader-plugins/bug?color=red&label=bugs">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Community-driven plugin repository for [LNReader](https://github.com/LNReader/lnreader). This repository hosts plugins and manages related issues and requests.
|
Community-driven plugin repository for [LNReader](https://github.com/LNReader/lnreader). This repository hosts plugins and manages related issues and requests.
|
||||||
|
|||||||
Reference in New Issue
Block a user