From 04db8d4eb41b7297ecb90ef1ed8712ce9ecd7984 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Tue, 22 Sep 2026 23:33:34 +0530 Subject: [PATCH] chore: Lowercase GitHub Labels --- .github/ISSUE_TEMPLATE/report_issue.yml | 2 +- .github/ISSUE_TEMPLATE/request_feature.yml | 2 +- .github/ISSUE_TEMPLATE/request_plugin.yml | 2 +- .github/scripts/blank_report_issue.yml | 2 +- .../generate-issue-template-options.cjs | 41 +++++++++++++------ .github/workflows/issue_auto_label.yml | 15 ++++--- .github/workflows/issue_moderator.yml | 4 +- .github/workflows/theme_auto_label.yml | 18 ++++---- README.md | 4 +- 9 files changed, 55 insertions(+), 35 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/report_issue.yml b/.github/ISSUE_TEMPLATE/report_issue.yml index 2f730f3..08d6f85 100644 --- a/.github/ISSUE_TEMPLATE/report_issue.yml +++ b/.github/ISSUE_TEMPLATE/report_issue.yml @@ -4,7 +4,7 @@ name: Report Issue description: Report a plugin issue in LNReader -labels: [Bug] +labels: [bug] body: - type: dropdown id: source diff --git a/.github/ISSUE_TEMPLATE/request_feature.yml b/.github/ISSUE_TEMPLATE/request_feature.yml index b240ef4..1437cce 100644 --- a/.github/ISSUE_TEMPLATE/request_feature.yml +++ b/.github/ISSUE_TEMPLATE/request_feature.yml @@ -1,6 +1,6 @@ name: Request Feature description: Suggest an improvement for an existing plugin -labels: [Feature Request] +labels: [feature request] body: - type: textarea id: feature-description diff --git a/.github/ISSUE_TEMPLATE/request_plugin.yml b/.github/ISSUE_TEMPLATE/request_plugin.yml index b3f255c..8bb2b42 100644 --- a/.github/ISSUE_TEMPLATE/request_plugin.yml +++ b/.github/ISSUE_TEMPLATE/request_plugin.yml @@ -1,6 +1,6 @@ name: Request Plugin description: Request a new plugin for LNReader -labels: [Plugin Request] +labels: [plugin request] body: - type: markdown attributes: diff --git a/.github/scripts/blank_report_issue.yml b/.github/scripts/blank_report_issue.yml index eae8ef0..6427259 100644 --- a/.github/scripts/blank_report_issue.yml +++ b/.github/scripts/blank_report_issue.yml @@ -4,7 +4,7 @@ name: Report Issue description: Report a plugin issue in LNReader -labels: [Bug] +labels: [bug] body: - type: dropdown id: source diff --git a/.github/scripts/generate-issue-template-options.cjs b/.github/scripts/generate-issue-template-options.cjs index 41b3f2d..8af5784 100644 --- a/.github/scripts/generate-issue-template-options.cjs +++ b/.github/scripts/generate-issue-template-options.cjs @@ -8,7 +8,7 @@ const rawText = fs.readFileSync( ); async function main() { - console.log(`Fetching plugins from: ${dist}`); + console.log(`Fetching published plugin manifest from ${dist}...`); try { const response = await fetch( @@ -22,7 +22,7 @@ async function main() { } 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) => { arr[plugin.lang + ': ' + plugin.name] = plugin.id; @@ -36,24 +36,41 @@ async function main() { fs.readFileSync('.github/scripts/keys.json', 'utf8'), ); savedKeys = Object.keys(keys); - console.log(`Loaded ${savedKeys.length} existing plugin keys`); + console.log(`Loaded ${savedKeys.length} saved plugin keys.`); } 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 - "'); - fs.writeFileSync( - '.github/ISSUE_TEMPLATE/report_issue.yml', - rawText.replace(/{#CHANGE#}/g, '- "' + text + '"'), + const text = newKeys.join('"\n - "'); + const issueTemplate = 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)); - console.log('Issue template updated successfully'); } 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) { return a.length === b.length && a.every(value => b.includes(value)); } diff --git a/.github/workflows/issue_auto_label.yml b/.github/workflows/issue_auto_label.yml index c88e9af..71f58f4 100644 --- a/.github/workflows/issue_auto_label.yml +++ b/.github/workflows/issue_auto_label.yml @@ -15,7 +15,7 @@ concurrency: jobs: auto-label: 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 permissions: contents: read @@ -64,13 +64,16 @@ jobs: 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/^[^:]*: //')" - # Add "Plugin: " in front of each label - LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/Plugin: /')" + LABELS="$(printf '%s' "$LABELS" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")" + + # Add "plugin: " in front of each label + LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/plugin: /')" FINAL_LABELS="$LABELS_WITH_PREFIX" 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 # Save to GitHub environment @@ -84,9 +87,9 @@ jobs: REPOSITORY: ${{ github.repository }} run: | 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" \ - '{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 - - name: Handle Missing Label diff --git a/.github/workflows/issue_moderator.yml b/.github/workflows/issue_moderator.yml index 481bc77..4df632e 100644 --- a/.github/workflows/issue_moderator.yml +++ b/.github/workflows/issue_moderator.yml @@ -19,11 +19,11 @@ jobs: uses: tachiyomiorg/issue-moderator-action@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - duplicate-label: Duplicate + duplicate-label: duplicate duplicate-check-enabled: true duplicate-check-labels: | - ["Plugin Request", "Domain Changed"] + ["plugin request", "domain changed"] existing-check-enabled: false diff --git a/.github/workflows/theme_auto_label.yml b/.github/workflows/theme_auto_label.yml index 3945f77..dd0f2e4 100644 --- a/.github/workflows/theme_auto_label.yml +++ b/.github/workflows/theme_auto_label.yml @@ -13,7 +13,7 @@ concurrency: jobs: auto-label: 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 permissions: issues: write @@ -126,20 +126,20 @@ jobs: run: | echo "## Theme Detection Result" >> $GITHUB_STEP_SUMMARY if [[ "$MADARA" == "true" ]]; then - echo "🏷️ Adding label: Theme: Madara" >> $GITHUB_STEP_SUMMARY - gh issue edit $ISSUE_NUMBER --add-label "Theme: Madara" -R $REPO + echo "🏷️ Adding label: theme: madara" >> $GITHUB_STEP_SUMMARY + gh issue edit $ISSUE_NUMBER --add-label "theme: madara" -R $REPO echo "theme=madara" >> "$GITHUB_OUTPUT" elif [[ "$LIGHNOVELWP" == "true" ]]; then - echo "🏷️ Adding label: Theme: Lighnovelwp" >> $GITHUB_STEP_SUMMARY - gh issue edit $ISSUE_NUMBER --add-label "Theme: Lighnovelwp" -R $REPO + echo "🏷️ Adding label: theme: lighnovelwp" >> $GITHUB_STEP_SUMMARY + gh issue edit $ISSUE_NUMBER --add-label "theme: lighnovelwp" -R $REPO echo "theme=lightnovelwp" >> "$GITHUB_OUTPUT" elif [[ "$HOTNOVELPUB" == "true" ]]; then - echo "🏷️ Adding label: Theme: Hotnovelpub" >> $GITHUB_STEP_SUMMARY - gh issue edit $ISSUE_NUMBER --add-label "Theme: Hotnovelpub" -R $REPO + echo "🏷️ Adding label: theme: hotnovelpub" >> $GITHUB_STEP_SUMMARY + gh issue edit $ISSUE_NUMBER --add-label "theme: hotnovelpub" -R $REPO echo "theme=hotnovelpub" >> "$GITHUB_OUTPUT" elif [[ "$FICTIONEER" == "true" ]]; then - echo "🏷️ Adding label: Theme: Fictioneer" >> $GITHUB_STEP_SUMMARY - gh issue edit $ISSUE_NUMBER --add-label "Theme: Fictioneer" -R $REPO + echo "🏷️ Adding label: theme: fictioneer" >> $GITHUB_STEP_SUMMARY + gh issue edit $ISSUE_NUMBER --add-label "theme: fictioneer" -R $REPO echo "theme=fictioneer" >> "$GITHUB_OUTPUT" else echo "❌ No Theme Detected" >> $GITHUB_STEP_SUMMARY diff --git a/README.md b/README.md index 6f24901..44f8de9 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@

Total number of available plugins -Open plugin requests -Open bug reports +Open plugin requests +Open bug reports

Community-driven plugin repository for [LNReader](https://github.com/LNReader/lnreader). This repository hosts plugins and manages related issues and requests.